repo_name stringlengths 6 101 | path stringlengths 4 300 | text stringlengths 7 1.31M |
|---|---|---|
MirekSz/webpack-es6-ts | app/mods/mod1986.js | import mod1985 from './mod1985';
var value=mod1985+1;
export default value;
|
belminksy/automaton | src/automaton/grid/World.java | /*
* MIT License
*
* Copyright (c) 2019 <NAME> and other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package automaton.grid;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import automaton.maths.Coordinates;
import automaton.maths.Point;
import automaton.render.RenderingContext;
/**
* <p>
* The world class represents the entire grid
* of the grid system.
* </p>
*
* <p>
* In the grid system, a world contains chunks, a chunk
* contains cells.
* </p>
*
* @author <NAME>
* @see Chunk
* @see Cell
*/
public class World {
/**
* The map where all chunks are stored with their coordinates.
*/
protected Map<Point, Chunk> chunks = new ConcurrentHashMap<>();
/**
* Updates all chunks.
*/
public void update() {
Iterator<Entry<Point, Chunk>> iterator = getChunks();
Chunk chunk;
while (iterator.hasNext()) {
iterator.next().getValue().updateNextState();
}
iterator = getChunks();
while (iterator.hasNext()) {
chunk = iterator.next().getValue();
chunk.updateState();
if (chunk.isEmpty()) {
remove(chunk);
iterator.remove();
}
}
}
/**
* Renders all chunks on a canvas through a rendering context.
*
* @param context The rendering context.
*/
public void render(RenderingContext context) {
Iterator<Entry<Point, Chunk>> iterator = getChunks();
while (iterator.hasNext()) {
iterator.next().getValue().render(context);
}
}
/**
* Creates a new living cell at the specified location.
* If a chunk does not exist at the location, it will
* be automatically added.
*
* @param coordinates The cell coordinates.
*
* @see #toogle(Coordinates)
*/
public void active(Coordinates coordinates) {
getChunkAt(coordinates, true).active(coordinates, true);
}
/**
* <p>
* Creates a new living cell at the specified location
* if there is not already a living cell. If a chunk
* does not exist at the location, it will be
* automatically added.
* </p>
*
* <p>
* Removes the cell at the specified location if there
* is a living cell.
* </p>
*
* @param coordinates The cell coordinates.
*
* @see #active(Coordinates)
*/
public void toogle(Coordinates coordinates) {
if (!hasChunkAt(coordinates)) {
active(coordinates);
return;
}
Chunk chunk = getChunkAt(coordinates);
if (!chunk.hasCellAt(coordinates)) {
active(coordinates);
return;
}
Cell cell = chunk.getCellAt(coordinates);
if (!cell.isAlive()) {
/* Need to remove the current cell whatever his state. */
chunk.remove(cell);
active(coordinates);
return;
}
chunk.remove(cell);
}
/**
* Indicates if a chunk is present at the specified location.
*
* @param coordinates The chunk coordinates.
*
* @return true if there is a chunk; false otherwise.
*/
public boolean hasChunkAt(Coordinates coordinates) {
return chunks.containsKey(coordinates.toChunkPoint());
}
/**
* Returns the chunk present at the specified location or null
* if it does not exist.
*
* @param coordinates The chunk coordinates.
*
* @return A chunk or null.
*
* @see #getChunkAt(Coordinates, boolean)
* @see Chunk
*/
public Chunk getChunkAt(Coordinates coordinates) {
return getChunkAt(coordinates, false);
}
/**
* <p>
* Returns the chunk present at the specified location.
* <p>
*
* <p>
* This method can force the creation of the chunk if it
* does not exist.
* </p>
*
* @param coordinates The chunk coordinates.
* @param force Precise if the chunk is forced to be created.
*
* @return A chunk or null.
*
* @see #getChunkAt(Coordinates)
* @see Chunk
*/
public Chunk getChunkAt(Coordinates coordinates, boolean force) {
if (!hasChunkAt(coordinates) && !force) {
return null;
}
if (!hasChunkAt(coordinates)) {
register(new Chunk(this, coordinates.clone().normalizeForChunk()));
}
return chunks.get(coordinates.toChunkPoint());
}
/**
* Registers a new chunk on the map.
*
* @param chunk The chunk to register.
*/
public void register(Chunk chunk) {
chunks.putIfAbsent(chunk.getCoordinates().toChunkPoint(), chunk);
}
/**
* Removes an existing chunk on the map.
*
* @param chunk The chunk to remove.
*/
public void remove(Chunk chunk) {
chunks.remove(chunk.getCoordinates().toChunkPoint());
}
/**
* Clears the entire world by remove all chunks.
*/
public void clear() {
chunks.clear();
}
/**
* Indicates if the world contains chunks or not.
*
* @return true if the chunk is empty; false otherwise.
*/
public boolean isEmpty() {
return chunks.isEmpty();
}
/**
* Returns an iterator of all chunks coupled with their
* chunk format coordinates.
*
* @return An iterator of all chunks.
*
* @see Chunk
* @see Point
*/
public Iterator<Entry<Point, Chunk>> getChunks() {
return chunks.entrySet().iterator();
}
}
|
chhatarshal/Datastructure | datastructure/problems/BalanceBracket.java | package com.csingh.datastructure.problems;
import java.util.Stack;
public class BalanceBracket {
private static Stack stack = new Stack();
private static String allBrackets = "[] {}()";
public static boolean balanceBracker(String s) {
for (int i = 0; i < s.length(); i ++) {
char c = s.charAt(i);
if (!isBracket(c)) {
continue;
}
if (stack.isEmpty()) {
stack.push(c);
} else {
char c2 = (char)stack.pop();
if (isPair(c2, c)) {
continue;
} else {
stack.push(c2);
stack.push(c);
}
}
}
return stack.isEmpty() ? true : false;
}
public static boolean isBracket(char c) {
return allBrackets.contains(String.valueOf(c));
}
public static boolean isPair(char c, char c2) {
if (c == '{') {
if (c2 == '}') {
return true;
}
}
if (c == '[') {
if (c2 == ']') {
return true;
}
}
if (c == '(') {
if (c2 == ')') {
return true;
}
}
return false;
}
public static void main(String[] args) {
System.out.println(balanceBracker("{[sffd[]{[][}]gdfgdf]}"));
}
}
|
wilsonsouza/xbw_32 | bb.groups_controller.hpp | <reponame>wilsonsouza/xbw_32
//-----------------------------------------------------------------------------------------------//
// xbw32 for Windows (generate of numeric combinations for bingo or lotery) (generate of numeric combinations for bingo or lotery)
//
// Created by wilsonsouza 2012, 2013, 2014, 2015, 2016, 2017, 2018
// For Olavo Co.
//
// WR Devinfo
// (c) 2012, 2014, 2015, 2018
// update of qt 5.01 to 5.11
//-----------------------------------------------------------------------------------------------//
#pragma once
#include <bb.defs.hpp>
namespace bb
{
//std::multimap<group_name, std::multimap<page_id, std::multimap<numbers_id, availables_total>>>
//
struct available_numbers_controller : public std::multimap<int, int>
{
using pointer = std::shared_ptr<available_numbers_controller>;
using available_numbers_type = std::multimap<int, int>;
std::unicodestring group_id{};
/**/
available_numbers_controller(std::unicodestring const & group_id) :
available_numbers_type{}
{
this->group_id = group_id;
}
value_type const & lookup(int const key)
{
return *find(key);
}
friend bool operator<(value_type const & left, value_type const & right)
{
return (left.first < right.first);
}
available_numbers_controller * update(value_type const & value_pair)
{
auto founded = find(value_pair.first);
//
if (founded != end())
{
founded->second = std::move(value_pair.second);
}
return this;
}
};
struct pages_controller;
using groups_controller_queue = std::list<pages_controller *>;
struct groups_controller : public groups_controller_queue, public task_group
{
using pointer = std::shared_ptr<groups_controller>;
std::shared_ptr<available_numbers_controller> availables_queue{ nullptr };
std::unicodestring group_id{};
explicit groups_controller(std::unicodestring const & group_id);
virtual ~groups_controller();
virtual groups_controller::pointer clone();
virtual pages_controller * search_page(int const page);
virtual void insert(pages_controller const * pages, int value);
virtual bool is_available(int value);
virtual void create_availables(int begin, int max);
};
} |
Furtif/POGOProtos-Java-Private | src/main/java/POGOProtos/Rpc/PingResponseProto.java | <gh_stars>1-10
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: POGOProtos.Rpc.proto
package POGOProtos.Rpc;
/**
* Protobuf type {@code POGOProtos.Rpc.PingResponseProto}
*/
public final class PingResponseProto extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:POGOProtos.Rpc.PingResponseProto)
PingResponseProtoOrBuilder {
private static final long serialVersionUID = 0L;
// Use PingResponseProto.newBuilder() to construct.
private PingResponseProto(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private PingResponseProto() {
userInfo_ = "";
serverInfo_ = "";
randomResponseBytes_ = "";
returnValue_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new PingResponseProto();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private PingResponseProto(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
java.lang.String s = input.readStringRequireUtf8();
userInfo_ = s;
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
serverInfo_ = s;
break;
}
case 26: {
java.lang.String s = input.readStringRequireUtf8();
randomResponseBytes_ = s;
break;
}
case 34: {
java.lang.String s = input.readStringRequireUtf8();
returnValue_ = s;
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_PingResponseProto_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_PingResponseProto_fieldAccessorTable
.ensureFieldAccessorsInitialized(
POGOProtos.Rpc.PingResponseProto.class, POGOProtos.Rpc.PingResponseProto.Builder.class);
}
public static final int USER_INFO_FIELD_NUMBER = 1;
private volatile java.lang.Object userInfo_;
/**
* <code>string user_info = 1;</code>
* @return The userInfo.
*/
@java.lang.Override
public java.lang.String getUserInfo() {
java.lang.Object ref = userInfo_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
userInfo_ = s;
return s;
}
}
/**
* <code>string user_info = 1;</code>
* @return The bytes for userInfo.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getUserInfoBytes() {
java.lang.Object ref = userInfo_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
userInfo_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int SERVER_INFO_FIELD_NUMBER = 2;
private volatile java.lang.Object serverInfo_;
/**
* <code>string server_info = 2;</code>
* @return The serverInfo.
*/
@java.lang.Override
public java.lang.String getServerInfo() {
java.lang.Object ref = serverInfo_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
serverInfo_ = s;
return s;
}
}
/**
* <code>string server_info = 2;</code>
* @return The bytes for serverInfo.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getServerInfoBytes() {
java.lang.Object ref = serverInfo_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
serverInfo_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int RANDOM_RESPONSE_BYTES_FIELD_NUMBER = 3;
private volatile java.lang.Object randomResponseBytes_;
/**
* <code>string random_response_bytes = 3;</code>
* @return The randomResponseBytes.
*/
@java.lang.Override
public java.lang.String getRandomResponseBytes() {
java.lang.Object ref = randomResponseBytes_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
randomResponseBytes_ = s;
return s;
}
}
/**
* <code>string random_response_bytes = 3;</code>
* @return The bytes for randomResponseBytes.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getRandomResponseBytesBytes() {
java.lang.Object ref = randomResponseBytes_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
randomResponseBytes_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int RETURN_VALUE_FIELD_NUMBER = 4;
private volatile java.lang.Object returnValue_;
/**
* <code>string return_value = 4;</code>
* @return The returnValue.
*/
@java.lang.Override
public java.lang.String getReturnValue() {
java.lang.Object ref = returnValue_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
returnValue_ = s;
return s;
}
}
/**
* <code>string return_value = 4;</code>
* @return The bytes for returnValue.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getReturnValueBytes() {
java.lang.Object ref = returnValue_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
returnValue_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(userInfo_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, userInfo_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serverInfo_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, serverInfo_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(randomResponseBytes_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, randomResponseBytes_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(returnValue_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 4, returnValue_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(userInfo_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, userInfo_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serverInfo_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, serverInfo_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(randomResponseBytes_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, randomResponseBytes_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(returnValue_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, returnValue_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof POGOProtos.Rpc.PingResponseProto)) {
return super.equals(obj);
}
POGOProtos.Rpc.PingResponseProto other = (POGOProtos.Rpc.PingResponseProto) obj;
if (!getUserInfo()
.equals(other.getUserInfo())) return false;
if (!getServerInfo()
.equals(other.getServerInfo())) return false;
if (!getRandomResponseBytes()
.equals(other.getRandomResponseBytes())) return false;
if (!getReturnValue()
.equals(other.getReturnValue())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + USER_INFO_FIELD_NUMBER;
hash = (53 * hash) + getUserInfo().hashCode();
hash = (37 * hash) + SERVER_INFO_FIELD_NUMBER;
hash = (53 * hash) + getServerInfo().hashCode();
hash = (37 * hash) + RANDOM_RESPONSE_BYTES_FIELD_NUMBER;
hash = (53 * hash) + getRandomResponseBytes().hashCode();
hash = (37 * hash) + RETURN_VALUE_FIELD_NUMBER;
hash = (53 * hash) + getReturnValue().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static POGOProtos.Rpc.PingResponseProto parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static POGOProtos.Rpc.PingResponseProto parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static POGOProtos.Rpc.PingResponseProto parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(POGOProtos.Rpc.PingResponseProto prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code POGOProtos.Rpc.PingResponseProto}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:POGOProtos.Rpc.PingResponseProto)
POGOProtos.Rpc.PingResponseProtoOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_PingResponseProto_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_PingResponseProto_fieldAccessorTable
.ensureFieldAccessorsInitialized(
POGOProtos.Rpc.PingResponseProto.class, POGOProtos.Rpc.PingResponseProto.Builder.class);
}
// Construct using POGOProtos.Rpc.PingResponseProto.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
userInfo_ = "";
serverInfo_ = "";
randomResponseBytes_ = "";
returnValue_ = "";
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_PingResponseProto_descriptor;
}
@java.lang.Override
public POGOProtos.Rpc.PingResponseProto getDefaultInstanceForType() {
return POGOProtos.Rpc.PingResponseProto.getDefaultInstance();
}
@java.lang.Override
public POGOProtos.Rpc.PingResponseProto build() {
POGOProtos.Rpc.PingResponseProto result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public POGOProtos.Rpc.PingResponseProto buildPartial() {
POGOProtos.Rpc.PingResponseProto result = new POGOProtos.Rpc.PingResponseProto(this);
result.userInfo_ = userInfo_;
result.serverInfo_ = serverInfo_;
result.randomResponseBytes_ = randomResponseBytes_;
result.returnValue_ = returnValue_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof POGOProtos.Rpc.PingResponseProto) {
return mergeFrom((POGOProtos.Rpc.PingResponseProto)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(POGOProtos.Rpc.PingResponseProto other) {
if (other == POGOProtos.Rpc.PingResponseProto.getDefaultInstance()) return this;
if (!other.getUserInfo().isEmpty()) {
userInfo_ = other.userInfo_;
onChanged();
}
if (!other.getServerInfo().isEmpty()) {
serverInfo_ = other.serverInfo_;
onChanged();
}
if (!other.getRandomResponseBytes().isEmpty()) {
randomResponseBytes_ = other.randomResponseBytes_;
onChanged();
}
if (!other.getReturnValue().isEmpty()) {
returnValue_ = other.returnValue_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
POGOProtos.Rpc.PingResponseProto parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (POGOProtos.Rpc.PingResponseProto) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object userInfo_ = "";
/**
* <code>string user_info = 1;</code>
* @return The userInfo.
*/
public java.lang.String getUserInfo() {
java.lang.Object ref = userInfo_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
userInfo_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string user_info = 1;</code>
* @return The bytes for userInfo.
*/
public com.google.protobuf.ByteString
getUserInfoBytes() {
java.lang.Object ref = userInfo_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
userInfo_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string user_info = 1;</code>
* @param value The userInfo to set.
* @return This builder for chaining.
*/
public Builder setUserInfo(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
userInfo_ = value;
onChanged();
return this;
}
/**
* <code>string user_info = 1;</code>
* @return This builder for chaining.
*/
public Builder clearUserInfo() {
userInfo_ = getDefaultInstance().getUserInfo();
onChanged();
return this;
}
/**
* <code>string user_info = 1;</code>
* @param value The bytes for userInfo to set.
* @return This builder for chaining.
*/
public Builder setUserInfoBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
userInfo_ = value;
onChanged();
return this;
}
private java.lang.Object serverInfo_ = "";
/**
* <code>string server_info = 2;</code>
* @return The serverInfo.
*/
public java.lang.String getServerInfo() {
java.lang.Object ref = serverInfo_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
serverInfo_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string server_info = 2;</code>
* @return The bytes for serverInfo.
*/
public com.google.protobuf.ByteString
getServerInfoBytes() {
java.lang.Object ref = serverInfo_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
serverInfo_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string server_info = 2;</code>
* @param value The serverInfo to set.
* @return This builder for chaining.
*/
public Builder setServerInfo(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
serverInfo_ = value;
onChanged();
return this;
}
/**
* <code>string server_info = 2;</code>
* @return This builder for chaining.
*/
public Builder clearServerInfo() {
serverInfo_ = getDefaultInstance().getServerInfo();
onChanged();
return this;
}
/**
* <code>string server_info = 2;</code>
* @param value The bytes for serverInfo to set.
* @return This builder for chaining.
*/
public Builder setServerInfoBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
serverInfo_ = value;
onChanged();
return this;
}
private java.lang.Object randomResponseBytes_ = "";
/**
* <code>string random_response_bytes = 3;</code>
* @return The randomResponseBytes.
*/
public java.lang.String getRandomResponseBytes() {
java.lang.Object ref = randomResponseBytes_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
randomResponseBytes_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string random_response_bytes = 3;</code>
* @return The bytes for randomResponseBytes.
*/
public com.google.protobuf.ByteString
getRandomResponseBytesBytes() {
java.lang.Object ref = randomResponseBytes_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
randomResponseBytes_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string random_response_bytes = 3;</code>
* @param value The randomResponseBytes to set.
* @return This builder for chaining.
*/
public Builder setRandomResponseBytes(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
randomResponseBytes_ = value;
onChanged();
return this;
}
/**
* <code>string random_response_bytes = 3;</code>
* @return This builder for chaining.
*/
public Builder clearRandomResponseBytes() {
randomResponseBytes_ = getDefaultInstance().getRandomResponseBytes();
onChanged();
return this;
}
/**
* <code>string random_response_bytes = 3;</code>
* @param value The bytes for randomResponseBytes to set.
* @return This builder for chaining.
*/
public Builder setRandomResponseBytesBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
randomResponseBytes_ = value;
onChanged();
return this;
}
private java.lang.Object returnValue_ = "";
/**
* <code>string return_value = 4;</code>
* @return The returnValue.
*/
public java.lang.String getReturnValue() {
java.lang.Object ref = returnValue_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
returnValue_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string return_value = 4;</code>
* @return The bytes for returnValue.
*/
public com.google.protobuf.ByteString
getReturnValueBytes() {
java.lang.Object ref = returnValue_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
returnValue_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string return_value = 4;</code>
* @param value The returnValue to set.
* @return This builder for chaining.
*/
public Builder setReturnValue(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
returnValue_ = value;
onChanged();
return this;
}
/**
* <code>string return_value = 4;</code>
* @return This builder for chaining.
*/
public Builder clearReturnValue() {
returnValue_ = getDefaultInstance().getReturnValue();
onChanged();
return this;
}
/**
* <code>string return_value = 4;</code>
* @param value The bytes for returnValue to set.
* @return This builder for chaining.
*/
public Builder setReturnValueBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
returnValue_ = value;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:POGOProtos.Rpc.PingResponseProto)
}
// @@protoc_insertion_point(class_scope:POGOProtos.Rpc.PingResponseProto)
private static final POGOProtos.Rpc.PingResponseProto DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new POGOProtos.Rpc.PingResponseProto();
}
public static POGOProtos.Rpc.PingResponseProto getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<PingResponseProto>
PARSER = new com.google.protobuf.AbstractParser<PingResponseProto>() {
@java.lang.Override
public PingResponseProto parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new PingResponseProto(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<PingResponseProto> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<PingResponseProto> getParserForType() {
return PARSER;
}
@java.lang.Override
public POGOProtos.Rpc.PingResponseProto getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
|
zhangycjob/jdcloud-sdk-java | pipeline/src/main/java/com/jdcloud/sdk/service/pipeline/model/GetLimitsResult.java | /*
* Copyright 2018 JDCLOUD.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.
*
* Limits
* The api for user limits
*
* OpenAPI spec version: v1
* Contact:
*
* NOTE: This class is auto generated by the jdcloud code generator program.
*/
package com.jdcloud.sdk.service.pipeline.model;
import com.jdcloud.sdk.service.JdcloudResult;
/**
* 查询用户限制
*/
public class GetLimitsResult extends JdcloudResult implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
* 流水线数量限制
*/
private Integer numberLimit;
/**
* 是否可以创建
*/
private Boolean canCreate;
/**
* get 流水线数量限制
*
* @return
*/
public Integer getNumberLimit() {
return numberLimit;
}
/**
* set 流水线数量限制
*
* @param numberLimit
*/
public void setNumberLimit(Integer numberLimit) {
this.numberLimit = numberLimit;
}
/**
* get 是否可以创建
*
* @return
*/
public Boolean getCanCreate() {
return canCreate;
}
/**
* set 是否可以创建
*
* @param canCreate
*/
public void setCanCreate(Boolean canCreate) {
this.canCreate = canCreate;
}
/**
* set 流水线数量限制
*
* @param numberLimit
*/
public GetLimitsResult numberLimit(Integer numberLimit) {
this.numberLimit = numberLimit;
return this;
}
/**
* set 是否可以创建
*
* @param canCreate
*/
public GetLimitsResult canCreate(Boolean canCreate) {
this.canCreate = canCreate;
return this;
}
} |
COLAB2/midca | midca/modules/_plan/jShop/JSHOP.py | <filename>midca/modules/_plan/jShop/JSHOP.py
import inspect, os
import subprocess
from subprocess import Popen, PIPE, STDOUT
def jshop(tasks, DOMAIN_FIILE, STATE_FILE):
thisDir = os.path.dirname(os.path.realpath(__file__))
# thisDir = "C:/Users/Zohreh/git/midca/modules/_plan/jShop/"
MIDCA_ROOT = thisDir + "/../../../"
# DOMAIN_FIILE = MIDCA_ROOT + "domains/jshop_domains/blocks_world/blocksworld.shp"
# #DOMAIN_FIILE = JSHOP_ROOT + "domains/jshop_domains/blocks_world/blocksworld.shp"
# STATE_FILE = MIDCA_ROOT + "domains/jshop_domains/blocks_world/bw_ran_problems_5.shp"
#
# f = open(STATE_FILE, 'r')
# a = f.read()
# print a
#
p = Popen(['java', '-jar', thisDir+'/jshop.jar', DOMAIN_FIILE,
STATE_FILE, '1'], stdout=PIPE, stderr=STDOUT)
for line in p.stdout:
print(line)
if(line.startswith(" ( (!")):
plan = line
break
if(plan):
Jshop_plan = parse(plan)
return Jshop_plan
def parenthetic_contents(string):
"""Generate parenthesized contents in string as pairs (level, contents)."""
stack = []
for i, c in enumerate(string):
if c == '(':
stack.append(i)
elif c == ')' and stack:
start = stack.pop()
yield (string[start + 1: i])
def parse(str):
elements = list(parenthetic_contents(str))
plan = []
for elm in elements:
if(elm[0] == '!' and '(' not in elm):
elm = elm[1:]
print(elm)
action_list = elm.strip().split(' ')
plan.append(action_list)
return plan
if __name__ == "__main__":
jshop("tasks")
|
theumang100/tutorials-1 | core-python/Core_Python/loop/LoopingTechnique.py | from math import isnan
# looping through dictionaries
'''tel = {"abc":9877,"def":9563}
for k,v in tel.items():
print(k,v)'''
# looping with two or more sequences
from builtins import print
'''que = ["name","nick name","favourite person"]
ans = ["deep","DD","My MoM"]
sign = [".","!","!"]
for q,a,s in zip(que,ans,sign):
print("what is your {0}? It is {1}{2}".format(q,a,s))'''
# loop over a sequence in reverse
'''for i in reversed(range(1,11)):
print(i)'''
# loop over a sequence in sorted order
'''fruits = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
# if we are sorting list we will have a duplicate value
for i in sorted(set(fruits)) :
print(i)'''
# manipulating a list while iterating
raw_data = [56.2, float('NaN'), 51.7, 55.3, 52.5, float('NaN'), 47.8]
data = []
for i in raw_data:
if not isnan(i):
data.append(i)
print("filtered data : ",data) |
Files-com/files-sdk-python | tests/test_group_user.py | import unittest
import inspect
import files_sdk
from tests.base import TestBase
from files_sdk.models import GroupUser
from files_sdk import group_user
class GroupUserTest(TestBase):
pass
# Instance Methods
@unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/group_users/{id}"), "Mock path does not exist")
def test_update(self):
params = {
"id" : 12345,
"group_id" : 12345,
"user_id" : 12345,
}
group_user = GroupUser(params)
group_user.update(params)
@unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/group_users/{id}"), "Mock path does not exist")
def test_delete(self):
params = {
"id" : 12345,
"group_id" : 12345,
"user_id" : 12345,
}
group_user = GroupUser(params)
group_user.delete(params)
# Alias of delete
def test_destroy(self):
pass
# Static Methods
@unittest.skipUnless(TestBase.mock_server_path_exists("GET", "/group_users"), "Mock path does not exist")
def test_list(self):
resp = group_user.list()
@unittest.skipUnless(TestBase.mock_server_path_exists("POST", "/group_users"), "Mock path does not exist")
def test_create(self):
params = {
"group_id" : 12345,
"user_id" : 12345,
}
group_user.create(params)
@unittest.skipUnless(TestBase.mock_server_path_exists("PATCH", "/group_users/{id}"), "Mock path does not exist")
def test_update(self):
id = 12345
params = {
"id" : 12345,
"group_id" : 12345,
"user_id" : 12345,
}
group_user.update(id, params)
@unittest.skipUnless(TestBase.mock_server_path_exists("DELETE", "/group_users/{id}"), "Mock path does not exist")
def test_delete(self):
id = 12345
params = {
"id" : 12345,
"group_id" : 12345,
"user_id" : 12345,
}
group_user.delete(id, params)
if __name__ == '__main__':
unittest.main() |
michalciolek/bricklinkapi | src/main/java/org/dajlab/bricklinkapi/v1/enumeration/NewOrUsed.java | /*
* Copyright 2020 <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 org.dajlab.bricklinkapi.v1.enumeration;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Condition of item criteria.
*
*/
public enum NewOrUsed {
NEW("N"), USED("U");
private String code;
private NewOrUsed(String code) {
this.code = code;
}
/**
* @return the code
*/
@JsonValue
public String getCode() {
return code;
}
/**
*
* @param code
* code
* @return the enum, or null if not found
*/
@JsonCreator
public static NewOrUsed fromCode(String code) {
for (NewOrUsed e : NewOrUsed.values()) {
if (e.getCode().equals(code)) {
return e;
}
}
return null;
}
}
|
psakar/Resteasy | arquillian/resteasy-cdi-ejb-test/src/main/java/org/jboss/resteasy/cdi/generic/ConcreteDecorator.java | <gh_stars>0
package org.jboss.resteasy.cdi.generic;
import java.util.logging.Logger;
import javax.decorator.Decorator;
import javax.decorator.Delegate;
import javax.inject.Inject;
import javax.ws.rs.core.Response;
/**
*
* @author <a href="<EMAIL>"><NAME></a>
* @version $Revision: 1.1 $
*
* Copyright Dec 15, 2012
*/
@Decorator
public abstract class ConcreteDecorator implements ConcreteResourceIntf
{
@Inject private Logger log;
private ConcreteResourceIntf resource;
@Inject
public ConcreteDecorator(@Delegate ConcreteResourceIntf resource)
{
this.resource = resource;
System.out.println("ConcreteDecorator got delegate: " + resource);
}
@Override
public Response execute()
{
log.info("entering ConcreteDecorator.execute()");
VisitList.add(VisitList.CONCRETE_DECORATOR_ENTER);
Response response = resource.testGenerics();
VisitList.add(VisitList.CONCRETE_DECORATOR_LEAVE);
log.info("leaving ConcreteDecorator.execute()");
return response;
}
@Override
abstract public Response testDecorators();
}
|
Ashwanigupta9125/code-DS-ALGO | HackerBlocks/More/SEGMENT TREE (MEDIUM) - CHEF AND SUBARRAY QUERIES.cpp | // https://www.codechef.com/problems/CSUBQ
#include<bits/stdc++.h>
#include<unordered_set>
using namespace std;
#define fio ios_base::sync_with_stdio(false)
#define ll long long int
#define s(x) scanf("%lld",&x)
#define s2(x,y) s(x)+s(y)
#define s3(x,y,z) s(x)+s(y)+s(z)
#define p(x) printf("%lld\n",x)
#define p2(x,y) p(x)+p(y)
#define p3(x,y,z) p(x)+p(y)+p(z)
#define F(i,a,b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define RF(i,a,b) for(ll i = (ll)(a); i >= (ll)(b); i--)
#define ff first
#define ss second
#define pll pair<ll,ll>
#define pb push_back
ll inf = 1e18;
ll mod = 1e9 + 7 ;
ll gcd(ll a , ll b){return b==0?a:gcd(b,a%b);}
struct treeNode{
ll ans;
ll len;
ll prefixSubArrays;
ll suffixSubArrays;
treeNode(){
ans=0ll;
len=1ll;
prefixSubArrays=0ll;
suffixSubArrays=0ll;
}
};
treeNode segtree[2][4*500000];
treeNode merge(treeNode leftChild,treeNode rightChild){
treeNode ret;
ret.len = leftChild.len + rightChild.len;
ret.ans = leftChild.ans + rightChild.ans;
ret.ans += leftChild.suffixSubArrays*rightChild.prefixSubArrays;
ret.prefixSubArrays = leftChild.prefixSubArrays;
if(leftChild.prefixSubArrays == leftChild.len)
ret.prefixSubArrays += rightChild.prefixSubArrays;
ret.suffixSubArrays = rightChild.suffixSubArrays;
if(rightChild.suffixSubArrays == rightChild.len)
ret.suffixSubArrays += leftChild.suffixSubArrays;
return ret;
}
void buildTree(ll treeNo,ll node,ll left,ll right,ll maxValue){
if(left>right)return;
if(left==right){
segtree[treeNo][node].ans=1ll;
segtree[treeNo][node].len=1ll;
segtree[treeNo][node].prefixSubArrays=1ll;
segtree[treeNo][node].suffixSubArrays=1ll;
return;
}
ll mid=left+right;
mid/=2;
buildTree(treeNo,2*node,left,mid,maxValue);
buildTree(treeNo,2*node+1,mid+1,right,maxValue);
segtree[treeNo][node]=merge(segtree[treeNo][2*node],segtree[treeNo][2*node+1]);
}
void updateTree(ll treeNo,ll node,ll left,ll right,ll maxValue,ll index,ll newValue){
if(left>right or index<left or index>right)return;
if(left==right){
segtree[treeNo][node].len = 1ll;
segtree[treeNo][node].ans = (newValue<maxValue);
segtree[treeNo][node].prefixSubArrays = (newValue<maxValue);
segtree[treeNo][node].suffixSubArrays = (newValue<maxValue);
return;
}
ll mid=left+right;
mid/=2;
updateTree(treeNo,2*node,left,mid,maxValue,index,newValue);
updateTree(treeNo,2*node+1,mid+1,right,maxValue,index,newValue);
segtree[treeNo][node]=merge(segtree[treeNo][2*node],segtree[treeNo][2*node+1]);
}
treeNode query(ll treeNo,ll node,ll left,ll right,ll lf,ll rt){
if(left>right or lf>right or rt<left){
treeNode nnode;
nnode.ans=0ll;
nnode.len=0ll;
nnode.prefixSubArrays = nnode.suffixSubArrays = 0ll;
return nnode;
}
if(lf<=left and rt>=right)return segtree[treeNo][node];
ll mid=(left+right)/2;
treeNode leftChild = query(treeNo,2*node,left,mid,lf,rt);
treeNode rightChild = query(treeNo,2*node+1,mid+1,right,lf,rt);
return merge(leftChild,rightChild);
}
int main()
{
freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
ll t=1;
// s(t);
while(t--){
ll n,q,L,R;
s2(n,q);
s2(L,R);
buildTree(0,1,1,n,L);
buildTree(1,1,1,n,R+1);
while(q--){
ll qtype;
s(qtype);
switch(qtype){
case 1: ll x,y;
s2(x,y);
updateTree(0,1,1,n,L,x,y);
updateTree(1,1,1,n,R+1,x,y);
break;
case 2: ll l,r;
s2(l,r);
ll ans = query(1,1,1,n,l,r).ans-query(0,1,1,n,l,r).ans;
p(ans);
break;
}
}
}
return 0;
} |
ProgMiner/Lab_Programming | src/ru/byprogminer/Lab7_Programming/LivingObjectWriter.java | <filename>src/ru/byprogminer/Lab7_Programming/LivingObjectWriter.java
package ru.byprogminer.Lab7_Programming;
import ru.byprogminer.Lab3_Programming.LivingObject;
import java.io.Flushable;
public interface LivingObjectWriter<E extends Exception> extends Flushable {
void write(LivingObject livingObject) throws E;
void writeMetadata(String key, String value) throws E;
}
|
adrian-badulescu/BlocklyAutomation | src/apps/tests/vscodeExtension/src/compiled/test.js | <gh_stars>1-10
console.log('!!!!!!!!!!!!!!!!!!!!asdasdasd'); |
dwp/ms-ui-submission | app/lib/data-utils/conditionDataUtils.js | <gh_stars>0
const Logger = require('../Logger');
const appLogger = Logger();
const getConditionFromJourneyData = (journeyData) => {
appLogger.info('conditionDataUtils: getConditionFromJourneyData called');
const conditionData = {
conditionName: journeyData.conditions ? journeyData.conditions.conditionName : '',
conditionStartDate: journeyData.conditions ? journeyData.conditions.conditionStartDate : '',
};
return conditionData;
};
const populateConditionJourneyData = (journeyData, data) => {
appLogger.info('conditionDataUtils: populateConditionJourneyData called');
journeyData.setDataForPage('conditions', {
conditionName: data.conditionName,
conditionStartDate: data.conditionStartDate,
});
journeyData.setDataForPage('another-health-condition', {
anotherCondition: 'yes',
});
};
const clearConditionJourneyData = (req) => {
appLogger.info('conditionDataUtils: clearConditionJourneyData called');
req.journeyData.setDataForPage('conditions', undefined);
if (req.journeyData.getDataForPage('another-health-condition') && req.journeyData.getDataForPage('another-health-condition').anotherCondition === 'yes') {
req.journeyData.setDataForPage('another-health-condition', undefined);
}
};
const updateSpecificCondition = (req) => {
appLogger.info('conditionDataUtils: updateSpecificCondition called');
const conditionData = getConditionFromJourneyData(req.journeyData.getData());
req.session.conditionGather[req.session.editIndex] = conditionData;
clearConditionJourneyData(req);
};
const getConditionsCount = (req) => {
appLogger.info('conditionDataUtils: getConditionsCount called');
return req.session.conditionGather.length;
};
const addConditionToGather = (req, isBack = false) => {
appLogger.info('conditionDataUtils: addConditionToGather called');
const conditionData = getConditionFromJourneyData(req.journeyData.getData());
req.session.conditionGather = req.session.conditionGather || [];
if (isBack) {
req.session.conditionGather.splice(req.session.conditionGather.length - 1, 1);
}
req.session.conditionGather.push(conditionData);
};
module.exports = {
getConditionFromJourneyData,
populateConditionJourneyData,
clearConditionJourneyData,
updateSpecificCondition,
addConditionToGather,
getConditionsCount,
};
|
gaoxiaoyang/webrtc | pc/sctp_utils.cc | /*
* Copyright 2013 The WebRTC 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 in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "pc/sctp_utils.h"
#include <stddef.h>
#include <stdint.h>
#include "rtc_base/byte_buffer.h"
#include "rtc_base/copy_on_write_buffer.h"
#include "rtc_base/logging.h"
namespace webrtc {
// Format defined at
// http://tools.ietf.org/html/draft-ietf-rtcweb-data-protocol-01#section
static const uint8_t DATA_CHANNEL_OPEN_MESSAGE_TYPE = 0x03;
static const uint8_t DATA_CHANNEL_OPEN_ACK_MESSAGE_TYPE = 0x02;
enum DataChannelOpenMessageChannelType {
DCOMCT_ORDERED_RELIABLE = 0x00,
DCOMCT_ORDERED_PARTIAL_RTXS = 0x01,
DCOMCT_ORDERED_PARTIAL_TIME = 0x02,
DCOMCT_UNORDERED_RELIABLE = 0x80,
DCOMCT_UNORDERED_PARTIAL_RTXS = 0x81,
DCOMCT_UNORDERED_PARTIAL_TIME = 0x82,
};
bool IsOpenMessage(const rtc::CopyOnWriteBuffer& payload) {
// Format defined at
// http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04
if (payload.size() < 1) {
RTC_LOG(LS_WARNING) << "Could not read OPEN message type.";
return false;
}
uint8_t message_type = payload[0];
return message_type == DATA_CHANNEL_OPEN_MESSAGE_TYPE;
}
bool ParseDataChannelOpenMessage(const rtc::CopyOnWriteBuffer& payload,
std::string* label,
DataChannelInit* config) {
// Format defined at
// http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04
rtc::ByteBufferReader buffer(payload.data<char>(), payload.size());
uint8_t message_type;
if (!buffer.ReadUInt8(&message_type)) {
RTC_LOG(LS_WARNING) << "Could not read OPEN message type.";
return false;
}
if (message_type != DATA_CHANNEL_OPEN_MESSAGE_TYPE) {
RTC_LOG(LS_WARNING) << "Data Channel OPEN message of unexpected type: "
<< message_type;
return false;
}
uint8_t channel_type;
if (!buffer.ReadUInt8(&channel_type)) {
RTC_LOG(LS_WARNING) << "Could not read OPEN message channel type.";
return false;
}
uint16_t priority;
if (!buffer.ReadUInt16(&priority)) {
RTC_LOG(LS_WARNING)
<< "Could not read OPEN message reliabilility prioirty.";
return false;
}
uint32_t reliability_param;
if (!buffer.ReadUInt32(&reliability_param)) {
RTC_LOG(LS_WARNING) << "Could not read OPEN message reliabilility param.";
return false;
}
uint16_t label_length;
if (!buffer.ReadUInt16(&label_length)) {
RTC_LOG(LS_WARNING) << "Could not read OPEN message label length.";
return false;
}
uint16_t protocol_length;
if (!buffer.ReadUInt16(&protocol_length)) {
RTC_LOG(LS_WARNING) << "Could not read OPEN message protocol length.";
return false;
}
if (!buffer.ReadString(label, (size_t)label_length)) {
RTC_LOG(LS_WARNING) << "Could not read OPEN message label";
return false;
}
if (!buffer.ReadString(&config->protocol, protocol_length)) {
RTC_LOG(LS_WARNING) << "Could not read OPEN message protocol.";
return false;
}
config->ordered = true;
switch (channel_type) {
case DCOMCT_UNORDERED_RELIABLE:
case DCOMCT_UNORDERED_PARTIAL_RTXS:
case DCOMCT_UNORDERED_PARTIAL_TIME:
config->ordered = false;
}
config->maxRetransmits = absl::nullopt;
config->maxRetransmitTime = absl::nullopt;
switch (channel_type) {
case DCOMCT_ORDERED_PARTIAL_RTXS:
case DCOMCT_UNORDERED_PARTIAL_RTXS:
config->maxRetransmits = reliability_param;
break;
case DCOMCT_ORDERED_PARTIAL_TIME:
case DCOMCT_UNORDERED_PARTIAL_TIME:
config->maxRetransmitTime = reliability_param;
break;
}
return true;
}
bool ParseDataChannelOpenAckMessage(const rtc::CopyOnWriteBuffer& payload) {
if (payload.size() < 1) {
RTC_LOG(LS_WARNING) << "Could not read OPEN_ACK message type.";
return false;
}
uint8_t message_type = payload[0];
if (message_type != DATA_CHANNEL_OPEN_ACK_MESSAGE_TYPE) {
RTC_LOG(LS_WARNING) << "Data Channel OPEN_ACK message of unexpected type: "
<< message_type;
return false;
}
return true;
}
bool WriteDataChannelOpenMessage(const std::string& label,
const DataChannelInit& config,
rtc::CopyOnWriteBuffer* payload) {
// Format defined at
// http://tools.ietf.org/html/draft-ietf-rtcweb-data-protocol-09#section-5.1
uint8_t channel_type = 0;
uint32_t reliability_param = 0;
uint16_t priority = 0;
if (config.ordered) {
if (config.maxRetransmits) {
channel_type = DCOMCT_ORDERED_PARTIAL_RTXS;
reliability_param = *config.maxRetransmits;
} else if (config.maxRetransmitTime) {
channel_type = DCOMCT_ORDERED_PARTIAL_TIME;
reliability_param = *config.maxRetransmitTime;
} else {
channel_type = DCOMCT_ORDERED_RELIABLE;
}
} else {
if (config.maxRetransmits) {
channel_type = DCOMCT_UNORDERED_PARTIAL_RTXS;
reliability_param = *config.maxRetransmits;
} else if (config.maxRetransmitTime) {
channel_type = DCOMCT_UNORDERED_PARTIAL_TIME;
reliability_param = *config.maxRetransmitTime;
} else {
channel_type = DCOMCT_UNORDERED_RELIABLE;
}
}
rtc::ByteBufferWriter buffer(NULL,
20 + label.length() + config.protocol.length());
// TODO(tommi): Add error handling and check resulting length.
buffer.WriteUInt8(DATA_CHANNEL_OPEN_MESSAGE_TYPE);
buffer.WriteUInt8(channel_type);
buffer.WriteUInt16(priority);
buffer.WriteUInt32(reliability_param);
buffer.WriteUInt16(static_cast<uint16_t>(label.length()));
buffer.WriteUInt16(static_cast<uint16_t>(config.protocol.length()));
buffer.WriteString(label);
buffer.WriteString(config.protocol);
payload->SetData(buffer.Data(), buffer.Length());
return true;
}
void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload) {
uint8_t data = DATA_CHANNEL_OPEN_ACK_MESSAGE_TYPE;
payload->SetData(&data, sizeof(data));
}
cricket::DataMessageType ToCricketDataMessageType(DataMessageType type) {
switch (type) {
case DataMessageType::kText:
return cricket::DMT_TEXT;
case DataMessageType::kBinary:
return cricket::DMT_BINARY;
case DataMessageType::kControl:
return cricket::DMT_CONTROL;
default:
return cricket::DMT_NONE;
}
return cricket::DMT_NONE;
}
DataMessageType ToWebrtcDataMessageType(cricket::DataMessageType type) {
switch (type) {
case cricket::DMT_TEXT:
return DataMessageType::kText;
case cricket::DMT_BINARY:
return DataMessageType::kBinary;
case cricket::DMT_CONTROL:
return DataMessageType::kControl;
case cricket::DMT_NONE:
default:
RTC_NOTREACHED();
}
return DataMessageType::kControl;
}
} // namespace webrtc
|
Flyves/Controller-Dev | src/main/java/util/rocket_league/game_situation/miscellaneous/UnhandledGameState.java | <filename>src/main/java/util/rocket_league/game_situation/miscellaneous/UnhandledGameState.java
package util.rocket_league.game_situation.miscellaneous;
import util.rocket_league.game_situation.GameSituation;
import util.timer.FrameTimer;
public class UnhandledGameState extends GameSituation {
public UnhandledGameState() {
super(new FrameTimer(0));
}
@Override
public void loadGameState() {}
}
|
kant/tdar | core/src/main/java/org/tdar/core/event/AbstractTdarEvent.java | <reponame>kant/tdar
package org.tdar.core.event;
import java.io.Serializable;
public abstract class AbstractTdarEvent implements Serializable {
private static final long serialVersionUID = -7606016589495469926L;
protected EventType type;
protected Object indexable;
private Long extraId;
public AbstractTdarEvent(Object indexable, EventType type) {
this.indexable = indexable;
this.type = type;
}
public AbstractTdarEvent(Object irFile, EventType type, Long extraId) {
this(irFile, type);
this.setExtraId(extraId);
}
public EventType getType() {
return type;
}
public void setType(EventType type) {
this.type = type;
}
public Object getRecord() {
return indexable;
}
public void setIndexable(Object indexable) {
this.indexable = indexable;
}
public Long getExtraId() {
return extraId;
}
public void setExtraId(Long extraId) {
this.extraId = extraId;
}
} |
linminglu/Fgame | game/marry/marry/marry_divorce_consent.go | <reponame>linminglu/Fgame
package marry
import (
"fgame/fgame/core/storage"
"fgame/fgame/game/global"
marryentity "fgame/fgame/game/marry/entity"
)
//协议离婚成功玩家下线数据
type MarryDivorceConsentObject struct {
Id int64
ServerId int32
PlayerId int64
UpdateTime int64
CreateTime int64
DeleteTime int64
}
func NewMarryDivorceConsentObject() *MarryDivorceConsentObject {
pso := &MarryDivorceConsentObject{}
return pso
}
func (mdco *MarryDivorceConsentObject) GetDBId() int64 {
return mdco.Id
}
func (mdco *MarryDivorceConsentObject) ToEntity() (e storage.Entity, err error) {
pe := &marryentity.MarryDivorceConsentEntity{}
pe.Id = mdco.Id
pe.ServerId = mdco.ServerId
pe.PlayerId = mdco.PlayerId
pe.UpdateTime = mdco.UpdateTime
pe.CreateTime = mdco.CreateTime
pe.DeleteTime = mdco.DeleteTime
e = pe
return
}
func (mdco *MarryDivorceConsentObject) FromEntity(e storage.Entity) (err error) {
pe, _ := e.(*marryentity.MarryDivorceConsentEntity)
mdco.Id = pe.Id
mdco.ServerId = pe.ServerId
mdco.PlayerId = pe.PlayerId
mdco.UpdateTime = pe.UpdateTime
mdco.CreateTime = pe.CreateTime
mdco.DeleteTime = pe.DeleteTime
return
}
func (mdco *MarryDivorceConsentObject) SetModified() {
e, err := mdco.ToEntity()
if err != nil {
return
}
global.GetGame().GetGlobalUpdater().AddChangedObject(e)
return
}
|
uk-gov-mirror/ministryofjustice.Claim-for-Crown-Court-Defence | spec/presenters/interim_claim_presenter_spec.rb | require 'rails_helper'
RSpec.describe Claim::InterimClaimPresenter do
let(:claim) { create :interim_claim }
subject { described_class.new(claim, view) }
it { expect(subject).to be_kind_of(Claim::BaseClaimPresenter) }
it 'has disbursements' do
expect(subject.can_have_disbursements?).to eq(true)
end
end
|
rwl/pylon | pylon/io/__init__.py | #------------------------------------------------------------------------------
# Copyright (C) 2007-2010 <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.
#------------------------------------------------------------------------------
""" For example:
from pylon.io import MATPOWERReader
"""
#------------------------------------------------------------------------------
# Imports:
#------------------------------------------------------------------------------
from pylon.io.pickle import PickleReader, PickleWriter
from matpower import MATPOWERReader, MATPOWERWriter
from psse import PSSEReader
from psse import PSSEWriter
#from psat import PSATReader
from rst import ReSTWriter
#from excel import ExcelWriter
#from excel import CSVWriter
from dot import DotWriter
#from rdf_io import RDFReader, RDFWriter
# EOF -------------------------------------------------------------------------
|
espenfl/aiida-codtools | aiida_codtools/parsers/cif_base.py | # -*- coding: utf-8 -*-
from aiida_codtools.parsers import BaseCodtoolsParser
from aiida_codtools.calculations.cif_cell_contents import CifBaseCalculation
class CifBaseParser(BaseCodtoolsParser):
"""
Generic parser plugin that should work or can easily be extended
to work with any of the scripts of the cod-tools package
"""
def __init__(self, calc):
self._supported_calculation_class = CifBaseCalculation
super(CifBaseParser, self).__init__(calc)
|
N-V-R/tdlib-ruby | lib/tdlib/types/update/user_chat_action.rb | <gh_stars>1-10
module TD::Types
# User activity in the chat has changed.
#
# @attr chat_id [Integer] Chat identifier.
# @attr message_thread_id [Integer] If not 0, a message thread identifier in which the action was performed.
# @attr user_id [Integer] Identifier of a user performing an action.
# @attr action [TD::Types::ChatAction] The action description.
class Update::UserChatAction < Update
attribute :chat_id, TD::Types::Integer
attribute :message_thread_id, TD::Types::Integer
attribute :user_id, TD::Types::Integer
attribute :action, TD::Types::ChatAction
end
end
|
definitio/Valetudo | backend/lib/entities/core/updater/ValetudoUpdaterErrorState.js | const ValetudoUpdaterState = require("./ValetudoUpdaterState");
class ValetudoUpdaterErrorState extends ValetudoUpdaterState {
/**
* The update process aborted with type, message at timestamp
*
* @param {object} options
* @param {ValetudoUpdaterErrorType} options.type
* @param {string} options.message
* @param {object} [options.metaData]
* @class
*/
constructor(options) {
super(options);
this.type = options.type;
this.message = options.message;
}
}
/**
* @typedef {string} ValetudoUpdaterErrorType
* @enum {string}
*
*/
ValetudoUpdaterErrorState.ERROR_TYPE = Object.freeze({
UNKNOWN: "unknown",
NOT_EMBEDDED: "not_embedded",
NOT_DOCKED: "not_docked",
NOT_WRITABLE: "not_writable",
NOT_ENOUGH_SPACE: "not_enough_space",
DOWNLOAD_FAILED: "download_failed",
NO_RELEASE: "no_release",
NO_MATCHING_BINARY: "no_matching_binary",
INVALID_CHECKSUM: "invalid_checksum",
});
module.exports = ValetudoUpdaterErrorState;
|
ytyaru/Ruby.docs.ruby.lang.org.20211028091759 | src/2_startup_ruby/S.rb | #!/bin/sh
exec ruby -S -x $0 "$@"
#! ruby
p 'Hello Ruby !!'
|
Mystic421980/aim-web-app | client/src/components/YouTubePlayer.js | import React from 'react'
const PLAYER_OPTIONS =
'cc_load_policy=1&controls=0&disablekb=1&rel=0&modestbranding=1&fs=0&iv_load_policy=3' +
'&autoplay=0&loop=1' +
`&enablejsapi=1&domain=https://${document.domain}`
export class YouTubePlayer extends React.Component {
constructor(props) {
super(props)
this.loadYouTubeAPI()
}
loadYouTubeAPI = () => {
window.onYouTubeIframeAPIReady = e => {
this.player = new window['YT'].Player('video-iframe', {
events: {
onReady: e => this.setPlayState(e.target),
onStateChange: this.onStateChange,
},
})
}
// async on-demand load of script
if (!document.getElementById('youtube-iframe-api')) {
var tag = document.createElement('script')
tag.id = 'youtube-iframe-api'
tag.src = 'https://www.youtube.com/iframe_api'
var firstScriptTag = document.getElementsByTagName('script')[0]
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag)
} else {
setTimeout(window.onYouTubeIframeAPIReady, 0)
}
}
onStateChange = event => {
this.props.onPlayStateChanged(event.data === 1)
}
setPlayState = (player = this.player) => {
if (this.props.playlistId) {
if (this.props.playing) {
player.playVideo()
} else {
player.pauseVideo()
}
}
}
next = () => {
if (this.props.playlistId) {
this.player.nextVideo()
}
}
componentDidUpdate() {
this.setPlayState()
}
render() {
const {
playlistId,
playing,
onPlayStateChanged,
...passThroughProps
} = this.props
return (
<iframe
id="video-iframe"
type="text/html"
frameBorder="0"
className="videos"
width="100%"
height="100%"
title="YouTube video player"
src={`https://www.youtube.com/embed?listType=playlist&list=${playlistId}&${PLAYER_OPTIONS}`}
{...passThroughProps}
/>
)
}
}
|
MarceloFossRJ/b109 | app/controllers/comments_controller.rb | class CommentsController < ApplicationController
before_filter :load_commentable
# GET /comments
# GET /comments.json
def index
@comments = @commentable.comments
respond_to do |format|
format.html # index.html.erb
format.json { render json: @comments }
end
end
# GET /comments/1
# GET /comments/1.json
def show
@comment = @commentable.comments.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @comment }
end
end
# GET /comments/new
# GET /comments/new.json
def new
@comment = @commentable.comments.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @comment }
end
end
# GET /comments/1/edit
def edit
@comment = Comment.find(params[:id])
end
# POST /comments
# POST /comments.json
def create
login_required
params[:comment][:user_id] = current_user.id
if Parameter.comments_published_automatically == 'true'
params[:comment][:is_published] = true
else
params[:comment][:is_published] = false
end
params[:comment][:is_validated] = false
@comment = @commentable.comments.new(params[:comment])
@blog = Post.find(params[:post_id])
respond_to do |format|
if @comment.save
format.html { redirect_to blog_path(@blog), notice: 'Comment was successfully created.' }
format.json { render json: blog_path(@blog), status: :created, location: @commentable }
else
format.html {redirect_to blog_path(@blog) }
format.json { render json: @commentable.errors, status: :unprocessable_entity }
end
end
end
# PUT /comments/1
# PUT /comments/1.json
def update
@comment = Comment.find(params[:id])
respond_to do |format|
if @comment.update_attributes(params[:comment])
format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @comment.errors, status: :unprocessable_entity }
end
end
end
# DELETE /comments/1
# DELETE /comments/1.json
def destroy
@comment = @commentable.comments.find(params[:id])
@comment.destroy
respond_to do |format|
format.html { redirect_to comments_url }
format.json { head :no_content }
end
end
private
def load_commentable
resource, id = request.path.split('/')[1,2]
@commentable = resource.singularize.classify.constantize.find(id)
end
end
|
protopopov1122/LuaCppB | headers/luacppb/Invoke/ArgRet.h | <reponame>protopopov1122/LuaCppB
/*
SPDX short identifier: MIT
Copyright 2018-2019 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
#ifndef LUACPPB_INVOKE_ARGRET_H_
#define LUACPPB_INVOKE_ARGRET_H_
#include "luacppb/Base.h"
#include "luacppb/Core/Runtime.h"
#include "luacppb/Core/Stack.h"
#include "luacppb/Core/State.h"
#include <type_traits>
#include <tuple>
#include <array>
namespace LuaCppB::Internal {
template <std::size_t I, typename T, typename E = void>
struct NativeFunctionArgument {
static T get(lua_State *, LuaCppRuntime &, LuaValue &);
static constexpr bool Virtual = false;
};
template <std::size_t I, typename T>
struct NativeFunctionArgument<I, T, typename std::enable_if<std::is_same<T, LuaState>::value>::type> {
static T get(lua_State *, LuaCppRuntime &, LuaValue &);
static constexpr bool Virtual = true;
};
template <std::size_t I, typename T>
struct NativeFunctionArgument<I, T, typename std::enable_if<std::is_same<T, LuaReferenceHandle>::value>::type> {
static T get(lua_State *, LuaCppRuntime &, LuaValue &);
static constexpr bool Virtual = false;
};
template <std::size_t Index, std::size_t Offset, std::size_t Count, typename ... T>
struct WrappedFunctionArguments_Impl {};
template <std::size_t Index, std::size_t Offset, std::size_t Count>
struct WrappedFunctionArguments_Impl<Index, Offset, Count> {
static void get(lua_State *, std::array<LuaValue, Count> &);
};
template <std::size_t Index, std::size_t Offset, std::size_t Count, typename T, typename ... Ts>
struct WrappedFunctionArguments_Impl<Index, Offset, Count, T, Ts...> {
static void get(lua_State *, std::array<LuaValue, Count> &);
};
template <std::size_t Offset, typename ... T>
struct WrappedFunctionArguments {
static void get(lua_State *, std::array<LuaValue, sizeof...(T)> &);
};
template <typename P, typename T, typename E = void>
struct NativeFunctionResult {
static int set(lua_State *, LuaCppRuntime &, T &&);
};
template <typename P, typename T>
struct NativeFunctionResult<P, T, typename std::enable_if<std::is_same<void, T>::value>::type> {};
template <typename P, typename T>
struct NativeFunctionResult<P, T, typename std::enable_if<is_instantiation<std::pair, T>::value>::type> {
static int set(lua_State *, LuaCppRuntime &, T &&);
};
template <typename P, std::size_t I, typename T>
struct NativeFunctionResult_Tuple {
static void push(lua_State *, LuaCppRuntime &, T &&);
};
template <typename P, typename T>
struct NativeFunctionResult<P, T, typename std::enable_if<is_instantiation<std::tuple, T>::value>::type> {
static int set(lua_State *, LuaCppRuntime &, T &&);
};
template <std::size_t Index, std::size_t Offset, std::size_t Count, typename ... Ts>
struct NativeFunctionArgumentsTuple_Impl {};
template <std::size_t Index, std::size_t Offset, std::size_t Count>
struct NativeFunctionArgumentsTuple_Impl<Index, Offset, Count> {
static std::tuple<> value(lua_State *, LuaCppRuntime &, std::array<LuaValue, Count> &);
};
template <std::size_t Index, std::size_t Offset, std::size_t Count, typename T, typename ... Ts>
struct NativeFunctionArgumentsTuple_Impl<Index, Offset, Count, T, Ts...> {
static std::tuple<T, Ts...> value(lua_State *, LuaCppRuntime &, std::array<LuaValue, Count> &);
};
template <std::size_t Offset, typename ... A>
struct NativeFunctionArgumentsTuple {
static std::tuple<A...> value(lua_State *, LuaCppRuntime &, std::array<LuaValue, sizeof...(A)> &);
};
}
#endif
|
rLadia-demo/AttacknidPatch | decompiled_src/CFR/org/anddev/andengine/entity/particle/modifier/IParticleModifier.java | /*
* Decompiled with CFR 0_79.
*/
package org.anddev.andengine.entity.particle.modifier;
import org.anddev.andengine.entity.particle.Particle;
import org.anddev.andengine.entity.particle.modifier.IParticleInitializer;
public interface IParticleModifier
extends IParticleInitializer {
public void onUpdateParticle(Particle var1);
}
|
Celebrate-future/openimaj | core/core-math/src/main/java/org/openimaj/math/util/MathUtils.java | <reponame>Celebrate-future/openimaj
/**
* Copyright (c) 2011, The University of Southampton and the individual contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of the University of Southampton nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.openimaj.math.util;
/**
* A collection of maths functions not available anywhere else ive seen
*
* @author <NAME> (<EMAIL>)
*
*/
public class MathUtils {
/**
* Given log(a) and log(b) calculate log(a + b) boils down to log(
* exp(log_a) + exp(log_b) ) but this might overflow, so we turn this into
* log([exp(log_a - log_c) + exp(log_b - log_c)]exp(log_c)) and we set log_c
* == max(log_a,log_b) and so it becomes: LARGE + log(1 + exp(SMALL -
* LARGE)) == LARGE + log(1 + SMALL) ~= large the whole idea being to avoid
* an overflow (exp(LARGE) == VERY LARGE == overflow)
*
* @param log_a
* @param log_b
* @return log(a+b)
*/
public static double logSum(final double log_a, final double log_b) {
double v;
if (log_a < log_b) {
v = log_b + Math.log(1 + Math.exp(log_a - log_b));
} else {
v = log_a + Math.log(1 + Math.exp(log_b - log_a));
}
return (v);
}
/**
* Returns the next power of 2 superior to n.
*
* @param n
* The value to find the next power of 2 above
* @return The next power of 2
*/
public static int nextPowerOf2(final int n) {
return (int) Math.pow(2, 32 - Integer.numberOfLeadingZeros(n - 1));
}
/**
* Implementation of the C <code>frexp</code> function to break
* floating-point number into normalized fraction and power of 2.
*
* @see "http://stackoverflow.com/questions/1552738/is-there-a-java-equivalent-of-frexp"
*
* @param value
* the value
* @return the exponent and mantissa of the input value
*/
public static ExponentAndMantissa frexp(double value) {
final ExponentAndMantissa ret = new ExponentAndMantissa();
ret.exponent = 0;
ret.mantissa = 0;
if (value == 0.0 || value == -0.0) {
return ret;
}
if (Double.isNaN(value)) {
ret.mantissa = Double.NaN;
ret.exponent = -1;
return ret;
}
if (Double.isInfinite(value)) {
ret.mantissa = value;
ret.exponent = -1;
return ret;
}
ret.mantissa = value;
ret.exponent = 0;
int sign = 1;
if (ret.mantissa < 0f) {
sign--;
ret.mantissa = -(ret.mantissa);
}
while (ret.mantissa < 0.5f) {
ret.mantissa *= 2.0f;
ret.exponent -= 1;
}
while (ret.mantissa >= 1.0f) {
ret.mantissa *= 0.5f;
ret.exponent++;
}
ret.mantissa *= sign;
return ret;
}
/**
* Class to hold an exponent and mantissa
*
* @author <NAME> (<EMAIL>)
*/
public static class ExponentAndMantissa {
/**
* The exponent
*/
public int exponent;
/**
* The mantissa
*/
public double mantissa;
}
}
|
npocmaka/Windows-Server-2003 | base/win32/fusion/tools/sxsexpress/core/msxml.h | /* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 3.02.88 */
/* at Thu Sep 25 09:49:37 1997
*/
/* Compiler settings for msxml.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: none
*/
//@@MIDL_FILE_HEADING( )
#include "rpc.h"
#include "rpcndr.h"
#ifndef __msxml_h__
#define __msxml_h__
#ifdef __cplusplus
extern "C"{
#endif
/* Forward Declarations */
#ifndef __IXMLElementCollection_FWD_DEFINED__
#define __IXMLElementCollection_FWD_DEFINED__
typedef interface IXMLElementCollection IXMLElementCollection;
#endif /* __IXMLElementCollection_FWD_DEFINED__ */
#ifndef __IXMLDocument_FWD_DEFINED__
#define __IXMLDocument_FWD_DEFINED__
typedef interface IXMLDocument IXMLDocument;
#endif /* __IXMLDocument_FWD_DEFINED__ */
#ifndef __IXMLElement_FWD_DEFINED__
#define __IXMLElement_FWD_DEFINED__
typedef interface IXMLElement IXMLElement;
#endif /* __IXMLElement_FWD_DEFINED__ */
#ifndef __IXMLError_FWD_DEFINED__
#define __IXMLError_FWD_DEFINED__
typedef interface IXMLError IXMLError;
#endif /* __IXMLError_FWD_DEFINED__ */
#ifndef __IXMLElementNotificationSink_FWD_DEFINED__
#define __IXMLElementNotificationSink_FWD_DEFINED__
typedef interface IXMLElementNotificationSink IXMLElementNotificationSink;
#endif /* __IXMLElementNotificationSink_FWD_DEFINED__ */
#ifndef __XMLDocument_FWD_DEFINED__
#define __XMLDocument_FWD_DEFINED__
#ifdef __cplusplus
typedef class XMLDocument XMLDocument;
#else
typedef struct XMLDocument XMLDocument;
#endif /* __cplusplus */
#endif /* __XMLDocument_FWD_DEFINED__ */
/* header files for imported files */
#include "unknwn.h"
#include "objidl.h"
#include "oaidl.h"
void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void __RPC_FAR * );
/****************************************
* Generated header for interface: __MIDL_itf_msxml_0000
* at Thu Sep 25 09:49:37 1997
* using MIDL 3.02.88
****************************************/
/* [local] */
//+-------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1997.
//
//--------------------------------------------------------------------------
extern RPC_IF_HANDLE __MIDL_itf_msxml_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_msxml_0000_v0_0_s_ifspec;
#ifndef __MSXML_LIBRARY_DEFINED__
#define __MSXML_LIBRARY_DEFINED__
/****************************************
* Generated header for library: MSXML
* at Thu Sep 25 09:49:37 1997
* using MIDL 3.02.88
****************************************/
/* [version][lcid][helpstring][uuid] */
typedef
enum xmlelemTYPE
{ XMLELEMTYPE_ELEMENT = 0,
XMLELEMTYPE_TEXT = XMLELEMTYPE_ELEMENT + 1,
XMLELEMTYPE_COMMENT = XMLELEMTYPE_TEXT + 1,
XMLELEMTYPE_DOCUMENT = XMLELEMTYPE_COMMENT + 1,
XMLELEMTYPE_DTD = XMLELEMTYPE_DOCUMENT + 1,
XMLELEMTYPE_PI = XMLELEMTYPE_DTD + 1,
XMLELEMTYPE_OTHER = XMLELEMTYPE_PI + 1
} XMLELEM_TYPE;
typedef struct _xml_error
{
unsigned int _nLine;
BSTR _pchBuf;
unsigned int _cchBuf;
unsigned int _ich;
BSTR _pszFound;
BSTR _pszExpected;
DWORD _reserved1;
DWORD _reserved2;
} XML_ERROR;
EXTERN_C const IID LIBID_MSXML;
#ifndef __IXMLElementCollection_INTERFACE_DEFINED__
#define __IXMLElementCollection_INTERFACE_DEFINED__
/****************************************
* Generated header for interface: IXMLElementCollection
* at Thu Sep 25 09:49:37 1997
* using MIDL 3.02.88
****************************************/
/* [uuid][local][object] */
EXTERN_C const IID IID_IXMLElementCollection;
#if defined(__cplusplus) && !defined(CINTERFACE)
interface DECLSPEC_UUID("65725580-9B5D-11d0-9BFE-00C04FC99C8E")
IXMLElementCollection : public IDispatch
{
public:
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_length(
/* [in] */ long v) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_length(
/* [out][retval] */ long __RPC_FAR *p) = 0;
virtual /* [id][hidden][restricted][propget] */ HRESULT STDMETHODCALLTYPE get__newEnum(
/* [out][retval] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE item(
/* [in][optional] */ VARIANT var1,
/* [in][optional] */ VARIANT var2,
/* [out][retval] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp) = 0;
};
#else /* C style interface */
typedef struct IXMLElementCollectionVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IXMLElementCollection __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IXMLElementCollection __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IXMLElementCollection __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
IXMLElementCollection __RPC_FAR * This,
/* [out] */ UINT __RPC_FAR *pctinfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
IXMLElementCollection __RPC_FAR * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
IXMLElementCollection __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
IXMLElementCollection __RPC_FAR * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
/* [out] */ VARIANT __RPC_FAR *pVarResult,
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
/* [out] */ UINT __RPC_FAR *puArgErr);
/* [id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_length )(
IXMLElementCollection __RPC_FAR * This,
/* [in] */ long v);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_length )(
IXMLElementCollection __RPC_FAR * This,
/* [out][retval] */ long __RPC_FAR *p);
/* [id][hidden][restricted][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get__newEnum )(
IXMLElementCollection __RPC_FAR * This,
/* [out][retval] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
/* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *item )(
IXMLElementCollection __RPC_FAR * This,
/* [in][optional] */ VARIANT var1,
/* [in][optional] */ VARIANT var2,
/* [out][retval] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp);
END_INTERFACE
} IXMLElementCollectionVtbl;
interface IXMLElementCollection
{
CONST_VTBL struct IXMLElementCollectionVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IXMLElementCollection_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IXMLElementCollection_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IXMLElementCollection_Release(This) \
(This)->lpVtbl -> Release(This)
#define IXMLElementCollection_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IXMLElementCollection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IXMLElementCollection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IXMLElementCollection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IXMLElementCollection_put_length(This,v) \
(This)->lpVtbl -> put_length(This,v)
#define IXMLElementCollection_get_length(This,p) \
(This)->lpVtbl -> get_length(This,p)
#define IXMLElementCollection_get__newEnum(This,ppUnk) \
(This)->lpVtbl -> get__newEnum(This,ppUnk)
#define IXMLElementCollection_item(This,var1,var2,ppDisp) \
(This)->lpVtbl -> item(This,var1,var2,ppDisp)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [id][propput] */ HRESULT STDMETHODCALLTYPE IXMLElementCollection_put_length_Proxy(
IXMLElementCollection __RPC_FAR * This,
/* [in] */ long v);
void __RPC_STUB IXMLElementCollection_put_length_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLElementCollection_get_length_Proxy(
IXMLElementCollection __RPC_FAR * This,
/* [out][retval] */ long __RPC_FAR *p);
void __RPC_STUB IXMLElementCollection_get_length_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][hidden][restricted][propget] */ HRESULT STDMETHODCALLTYPE IXMLElementCollection_get__newEnum_Proxy(
IXMLElementCollection __RPC_FAR * This,
/* [out][retval] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
void __RPC_STUB IXMLElementCollection_get__newEnum_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id] */ HRESULT STDMETHODCALLTYPE IXMLElementCollection_item_Proxy(
IXMLElementCollection __RPC_FAR * This,
/* [in][optional] */ VARIANT var1,
/* [in][optional] */ VARIANT var2,
/* [out][retval] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp);
void __RPC_STUB IXMLElementCollection_item_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IXMLElementCollection_INTERFACE_DEFINED__ */
#ifndef __IXMLDocument_INTERFACE_DEFINED__
#define __IXMLDocument_INTERFACE_DEFINED__
/****************************************
* Generated header for interface: IXMLDocument
* at Thu Sep 25 09:49:37 1997
* using MIDL 3.02.88
****************************************/
/* [uuid][local][object] */
EXTERN_C const IID IID_IXMLDocument;
#if defined(__cplusplus) && !defined(CINTERFACE)
interface DECLSPEC_UUID("F52E2B61-18A1-11d1-B105-00805F49916B")
IXMLDocument : public IDispatch
{
public:
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_root(
/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileSize(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileModifiedDate(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileUpdatedDate(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_URL(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_URL(
/* [in] */ BSTR p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mimeType(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_readyState(
/* [out][retval] */ long __RPC_FAR *pl) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_charset(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_charset(
/* [in] */ BSTR p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_version(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_doctype(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_dtdURL(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE createElement(
/* [in] */ VARIANT vType,
/* [in][optional] */ VARIANT var1,
/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppElem) = 0;
};
#else /* C style interface */
typedef struct IXMLDocumentVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IXMLDocument __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IXMLDocument __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IXMLDocument __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
IXMLDocument __RPC_FAR * This,
/* [out] */ UINT __RPC_FAR *pctinfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
IXMLDocument __RPC_FAR * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
IXMLDocument __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
IXMLDocument __RPC_FAR * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
/* [out] */ VARIANT __RPC_FAR *pVarResult,
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
/* [out] */ UINT __RPC_FAR *puArgErr);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_root )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_fileSize )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_fileModifiedDate )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_fileUpdatedDate )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_URL )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_URL )(
IXMLDocument __RPC_FAR * This,
/* [in] */ BSTR p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_mimeType )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_readyState )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ long __RPC_FAR *pl);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_charset )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_charset )(
IXMLDocument __RPC_FAR * This,
/* [in] */ BSTR p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_version )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_doctype )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_dtdURL )(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *createElement )(
IXMLDocument __RPC_FAR * This,
/* [in] */ VARIANT vType,
/* [in][optional] */ VARIANT var1,
/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppElem);
END_INTERFACE
} IXMLDocumentVtbl;
interface IXMLDocument
{
CONST_VTBL struct IXMLDocumentVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IXMLDocument_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IXMLDocument_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IXMLDocument_Release(This) \
(This)->lpVtbl -> Release(This)
#define IXMLDocument_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IXMLDocument_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IXMLDocument_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IXMLDocument_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IXMLDocument_get_root(This,p) \
(This)->lpVtbl -> get_root(This,p)
#define IXMLDocument_get_fileSize(This,p) \
(This)->lpVtbl -> get_fileSize(This,p)
#define IXMLDocument_get_fileModifiedDate(This,p) \
(This)->lpVtbl -> get_fileModifiedDate(This,p)
#define IXMLDocument_get_fileUpdatedDate(This,p) \
(This)->lpVtbl -> get_fileUpdatedDate(This,p)
#define IXMLDocument_get_URL(This,p) \
(This)->lpVtbl -> get_URL(This,p)
#define IXMLDocument_put_URL(This,p) \
(This)->lpVtbl -> put_URL(This,p)
#define IXMLDocument_get_mimeType(This,p) \
(This)->lpVtbl -> get_mimeType(This,p)
#define IXMLDocument_get_readyState(This,pl) \
(This)->lpVtbl -> get_readyState(This,pl)
#define IXMLDocument_get_charset(This,p) \
(This)->lpVtbl -> get_charset(This,p)
#define IXMLDocument_put_charset(This,p) \
(This)->lpVtbl -> put_charset(This,p)
#define IXMLDocument_get_version(This,p) \
(This)->lpVtbl -> get_version(This,p)
#define IXMLDocument_get_doctype(This,p) \
(This)->lpVtbl -> get_doctype(This,p)
#define IXMLDocument_get_dtdURL(This,p) \
(This)->lpVtbl -> get_dtdURL(This,p)
#define IXMLDocument_createElement(This,vType,var1,ppElem) \
(This)->lpVtbl -> createElement(This,vType,var1,ppElem)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_root_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_root_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_fileSize_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_fileSize_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_fileModifiedDate_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_fileModifiedDate_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_fileUpdatedDate_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_fileUpdatedDate_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_URL_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_URL_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propput] */ HRESULT STDMETHODCALLTYPE IXMLDocument_put_URL_Proxy(
IXMLDocument __RPC_FAR * This,
/* [in] */ BSTR p);
void __RPC_STUB IXMLDocument_put_URL_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_mimeType_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_mimeType_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_readyState_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ long __RPC_FAR *pl);
void __RPC_STUB IXMLDocument_get_readyState_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_charset_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_charset_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propput] */ HRESULT STDMETHODCALLTYPE IXMLDocument_put_charset_Proxy(
IXMLDocument __RPC_FAR * This,
/* [in] */ BSTR p);
void __RPC_STUB IXMLDocument_put_charset_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_version_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_version_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_doctype_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_doctype_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLDocument_get_dtdURL_Proxy(
IXMLDocument __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLDocument_get_dtdURL_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id] */ HRESULT STDMETHODCALLTYPE IXMLDocument_createElement_Proxy(
IXMLDocument __RPC_FAR * This,
/* [in] */ VARIANT vType,
/* [in][optional] */ VARIANT var1,
/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppElem);
void __RPC_STUB IXMLDocument_createElement_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IXMLDocument_INTERFACE_DEFINED__ */
#ifndef __IXMLElement_INTERFACE_DEFINED__
#define __IXMLElement_INTERFACE_DEFINED__
/****************************************
* Generated header for interface: IXMLElement
* at Thu Sep 25 09:49:37 1997
* using MIDL 3.02.88
****************************************/
/* [uuid][local][object] */
EXTERN_C const IID IID_IXMLElement;
#if defined(__cplusplus) && !defined(CINTERFACE)
interface DECLSPEC_UUID("3F7F31AC-E15F-11d0-9C25-00C04FC99C8E")
IXMLElement : public IDispatch
{
public:
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_tagName(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_tagName(
/* [in] */ BSTR p) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parent(
/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppParent) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE setAttribute(
/* [in] */ BSTR strPropertyName,
/* [in] */ VARIANT PropertyValue) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE getAttribute(
/* [in] */ BSTR strPropertyName,
/* [out][retval] */ VARIANT __RPC_FAR *PropertyValue) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeAttribute(
/* [in] */ BSTR strPropertyName) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_children(
/* [out][retval] */ IXMLElementCollection __RPC_FAR *__RPC_FAR *pp) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_type(
/* [out][retval] */ long __RPC_FAR *plType) = 0;
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_text(
/* [out][retval] */ BSTR __RPC_FAR *p) = 0;
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_text(
/* [in] */ BSTR p) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE addChild(
/* [in] */ IXMLElement __RPC_FAR *pChildElem,
long lIndex,
long lReserved) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeChild(
/* [in] */ IXMLElement __RPC_FAR *pChildElem) = 0;
};
#else /* C style interface */
typedef struct IXMLElementVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IXMLElement __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IXMLElement __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IXMLElement __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
IXMLElement __RPC_FAR * This,
/* [out] */ UINT __RPC_FAR *pctinfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
IXMLElement __RPC_FAR * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
IXMLElement __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
IXMLElement __RPC_FAR * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
/* [out] */ VARIANT __RPC_FAR *pVarResult,
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
/* [out] */ UINT __RPC_FAR *puArgErr);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_tagName )(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_tagName )(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR p);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_parent )(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppParent);
/* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *setAttribute )(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR strPropertyName,
/* [in] */ VARIANT PropertyValue);
/* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *getAttribute )(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR strPropertyName,
/* [out][retval] */ VARIANT __RPC_FAR *PropertyValue);
/* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *removeAttribute )(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR strPropertyName);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_children )(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ IXMLElementCollection __RPC_FAR *__RPC_FAR *pp);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_type )(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ long __RPC_FAR *plType);
/* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_text )(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
/* [id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_text )(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR p);
/* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *addChild )(
IXMLElement __RPC_FAR * This,
/* [in] */ IXMLElement __RPC_FAR *pChildElem,
long lIndex,
long lReserved);
/* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *removeChild )(
IXMLElement __RPC_FAR * This,
/* [in] */ IXMLElement __RPC_FAR *pChildElem);
END_INTERFACE
} IXMLElementVtbl;
interface IXMLElement
{
CONST_VTBL struct IXMLElementVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IXMLElement_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IXMLElement_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IXMLElement_Release(This) \
(This)->lpVtbl -> Release(This)
#define IXMLElement_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IXMLElement_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IXMLElement_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IXMLElement_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IXMLElement_get_tagName(This,p) \
(This)->lpVtbl -> get_tagName(This,p)
#define IXMLElement_put_tagName(This,p) \
(This)->lpVtbl -> put_tagName(This,p)
#define IXMLElement_get_parent(This,ppParent) \
(This)->lpVtbl -> get_parent(This,ppParent)
#define IXMLElement_setAttribute(This,strPropertyName,PropertyValue) \
(This)->lpVtbl -> setAttribute(This,strPropertyName,PropertyValue)
#define IXMLElement_getAttribute(This,strPropertyName,PropertyValue) \
(This)->lpVtbl -> getAttribute(This,strPropertyName,PropertyValue)
#define IXMLElement_removeAttribute(This,strPropertyName) \
(This)->lpVtbl -> removeAttribute(This,strPropertyName)
#define IXMLElement_get_children(This,pp) \
(This)->lpVtbl -> get_children(This,pp)
#define IXMLElement_get_type(This,plType) \
(This)->lpVtbl -> get_type(This,plType)
#define IXMLElement_get_text(This,p) \
(This)->lpVtbl -> get_text(This,p)
#define IXMLElement_put_text(This,p) \
(This)->lpVtbl -> put_text(This,p)
#define IXMLElement_addChild(This,pChildElem,lIndex,lReserved) \
(This)->lpVtbl -> addChild(This,pChildElem,lIndex,lReserved)
#define IXMLElement_removeChild(This,pChildElem) \
(This)->lpVtbl -> removeChild(This,pChildElem)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLElement_get_tagName_Proxy(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLElement_get_tagName_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propput] */ HRESULT STDMETHODCALLTYPE IXMLElement_put_tagName_Proxy(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR p);
void __RPC_STUB IXMLElement_put_tagName_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLElement_get_parent_Proxy(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppParent);
void __RPC_STUB IXMLElement_get_parent_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id] */ HRESULT STDMETHODCALLTYPE IXMLElement_setAttribute_Proxy(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR strPropertyName,
/* [in] */ VARIANT PropertyValue);
void __RPC_STUB IXMLElement_setAttribute_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id] */ HRESULT STDMETHODCALLTYPE IXMLElement_getAttribute_Proxy(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR strPropertyName,
/* [out][retval] */ VARIANT __RPC_FAR *PropertyValue);
void __RPC_STUB IXMLElement_getAttribute_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id] */ HRESULT STDMETHODCALLTYPE IXMLElement_removeAttribute_Proxy(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR strPropertyName);
void __RPC_STUB IXMLElement_removeAttribute_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLElement_get_children_Proxy(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ IXMLElementCollection __RPC_FAR *__RPC_FAR *pp);
void __RPC_STUB IXMLElement_get_children_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLElement_get_type_Proxy(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ long __RPC_FAR *plType);
void __RPC_STUB IXMLElement_get_type_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propget] */ HRESULT STDMETHODCALLTYPE IXMLElement_get_text_Proxy(
IXMLElement __RPC_FAR * This,
/* [out][retval] */ BSTR __RPC_FAR *p);
void __RPC_STUB IXMLElement_get_text_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id][propput] */ HRESULT STDMETHODCALLTYPE IXMLElement_put_text_Proxy(
IXMLElement __RPC_FAR * This,
/* [in] */ BSTR p);
void __RPC_STUB IXMLElement_put_text_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id] */ HRESULT STDMETHODCALLTYPE IXMLElement_addChild_Proxy(
IXMLElement __RPC_FAR * This,
/* [in] */ IXMLElement __RPC_FAR *pChildElem,
long lIndex,
long lReserved);
void __RPC_STUB IXMLElement_addChild_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [id] */ HRESULT STDMETHODCALLTYPE IXMLElement_removeChild_Proxy(
IXMLElement __RPC_FAR * This,
/* [in] */ IXMLElement __RPC_FAR *pChildElem);
void __RPC_STUB IXMLElement_removeChild_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IXMLElement_INTERFACE_DEFINED__ */
#ifndef __IXMLError_INTERFACE_DEFINED__
#define __IXMLError_INTERFACE_DEFINED__
/****************************************
* Generated header for interface: IXMLError
* at Thu Sep 25 09:49:37 1997
* using MIDL 3.02.88
****************************************/
/* [uuid][local][object] */
EXTERN_C const IID IID_IXMLError;
#if defined(__cplusplus) && !defined(CINTERFACE)
interface DECLSPEC_UUID("948C5AD3-C58D-11d0-9C0B-00C04FC99C8E")
IXMLError : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetErrorInfo(
XML_ERROR __RPC_FAR *pErrorReturn) = 0;
};
#else /* C style interface */
typedef struct IXMLErrorVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IXMLError __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IXMLError __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IXMLError __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorInfo )(
IXMLError __RPC_FAR * This,
XML_ERROR __RPC_FAR *pErrorReturn);
END_INTERFACE
} IXMLErrorVtbl;
interface IXMLError
{
CONST_VTBL struct IXMLErrorVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IXMLError_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IXMLError_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IXMLError_Release(This) \
(This)->lpVtbl -> Release(This)
#define IXMLError_GetErrorInfo(This,pErrorReturn) \
(This)->lpVtbl -> GetErrorInfo(This,pErrorReturn)
#endif /* COBJMACROS */
#endif /* C style interface */
HRESULT STDMETHODCALLTYPE IXMLError_GetErrorInfo_Proxy(
IXMLError __RPC_FAR * This,
XML_ERROR __RPC_FAR *pErrorReturn);
void __RPC_STUB IXMLError_GetErrorInfo_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IXMLError_INTERFACE_DEFINED__ */
#ifndef __IXMLElementNotificationSink_INTERFACE_DEFINED__
#define __IXMLElementNotificationSink_INTERFACE_DEFINED__
/****************************************
* Generated header for interface: IXMLElementNotificationSink
* at Thu Sep 25 09:49:37 1997
* using MIDL 3.02.88
****************************************/
/* [uuid][local][object] */
EXTERN_C const IID IID_IXMLElementNotificationSink;
#if defined(__cplusplus) && !defined(CINTERFACE)
interface DECLSPEC_UUID("D9F1E15A-CCDB-11d0-9C0C-00C04FC99C8E")
IXMLElementNotificationSink : public IDispatch
{
public:
virtual /* [id] */ HRESULT STDMETHODCALLTYPE ChildAdded(
/* [in] */ IDispatch __RPC_FAR *pChildElem) = 0;
};
#else /* C style interface */
typedef struct IXMLElementNotificationSinkVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IXMLElementNotificationSink __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IXMLElementNotificationSink __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IXMLElementNotificationSink __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
IXMLElementNotificationSink __RPC_FAR * This,
/* [out] */ UINT __RPC_FAR *pctinfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
IXMLElementNotificationSink __RPC_FAR * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
IXMLElementNotificationSink __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
IXMLElementNotificationSink __RPC_FAR * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
/* [out] */ VARIANT __RPC_FAR *pVarResult,
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
/* [out] */ UINT __RPC_FAR *puArgErr);
/* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ChildAdded )(
IXMLElementNotificationSink __RPC_FAR * This,
/* [in] */ IDispatch __RPC_FAR *pChildElem);
END_INTERFACE
} IXMLElementNotificationSinkVtbl;
interface IXMLElementNotificationSink
{
CONST_VTBL struct IXMLElementNotificationSinkVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IXMLElementNotificationSink_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IXMLElementNotificationSink_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IXMLElementNotificationSink_Release(This) \
(This)->lpVtbl -> Release(This)
#define IXMLElementNotificationSink_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IXMLElementNotificationSink_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IXMLElementNotificationSink_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IXMLElementNotificationSink_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IXMLElementNotificationSink_ChildAdded(This,pChildElem) \
(This)->lpVtbl -> ChildAdded(This,pChildElem)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [id] */ HRESULT STDMETHODCALLTYPE IXMLElementNotificationSink_ChildAdded_Proxy(
IXMLElementNotificationSink __RPC_FAR * This,
/* [in] */ IDispatch __RPC_FAR *pChildElem);
void __RPC_STUB IXMLElementNotificationSink_ChildAdded_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IXMLElementNotificationSink_INTERFACE_DEFINED__ */
EXTERN_C const CLSID CLSID_XMLDocument;
#ifdef __cplusplus
class DECLSPEC_UUID("CFC399AF-D876-11d0-9C10-00C04FC99C8E")
XMLDocument;
#endif
#endif /* __MSXML_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
|
salomon42/openvswitch-ovs | vswitchd/ovs-brcompatd.c | /* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks
*
* 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 <config.h>
#include <asm/param.h>
#include <assert.h>
#include <errno.h>
#include <getopt.h>
#include <inttypes.h>
#include <limits.h>
#include <net/if.h>
#include <linux/genetlink.h>
#include <linux/rtnetlink.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <fcntl.h>
#include <unistd.h>
#include "command-line.h"
#include "coverage.h"
#include "daemon.h"
#include "dirs.h"
#include "dynamic-string.h"
#include "fatal-signal.h"
#include "json.h"
#include "leak-checker.h"
#include "netdev.h"
#include "netlink.h"
#include "netlink-socket.h"
#include "ofpbuf.h"
#include "openvswitch/brcompat-netlink.h"
#include "ovsdb-idl.h"
#include "packets.h"
#include "poll-loop.h"
#include "process.h"
#include "signals.h"
#include "sset.h"
#include "timeval.h"
#include "unixctl.h"
#include "util.h"
#include "vlog.h"
#include "vswitchd/vswitch-idl.h"
VLOG_DEFINE_THIS_MODULE(brcompatd);
/* xxx Just hangs if datapath is rmmod/insmod. Learn to reconnect? */
/* Actions to modify bridge compatibility configuration. */
enum bmc_action {
BMC_ADD_DP,
BMC_DEL_DP,
BMC_ADD_PORT,
BMC_DEL_PORT
};
static const char *parse_options(int argc, char *argv[]);
static void usage(void) NO_RETURN;
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 60);
/* Maximum number of milliseconds to wait before pruning port entries that
* no longer exist. If set to zero, ports are never pruned. */
static int prune_timeout = 5000;
/* Shell command to execute (via popen()) to send a control command to the
* running ovs-vswitchd process. The string must contain one instance of %s,
* which is replaced by the control command. */
static char *appctl_command;
/* Netlink socket to listen for interface changes. */
static struct nl_sock *rtnl_sock;
/* Netlink socket to bridge compatibility kernel module. */
static struct nl_sock *brc_sock;
/* The Generic Netlink family number used for bridge compatibility. */
static int brc_family;
static const struct nl_policy brc_multicast_policy[] = {
[BRC_GENL_A_MC_GROUP] = {.type = NL_A_U32 }
};
static const struct nl_policy rtnlgrp_link_policy[] = {
[IFLA_IFNAME] = { .type = NL_A_STRING, .optional = false },
[IFLA_MASTER] = { .type = NL_A_U32, .optional = true },
};
static int
lookup_brc_multicast_group(int *multicast_group)
{
struct nl_sock *sock;
struct ofpbuf request, *reply;
struct nlattr *attrs[ARRAY_SIZE(brc_multicast_policy)];
int retval;
retval = nl_sock_create(NETLINK_GENERIC, &sock);
if (retval) {
return retval;
}
ofpbuf_init(&request, 0);
nl_msg_put_genlmsghdr(&request, 0, brc_family,
NLM_F_REQUEST, BRC_GENL_C_QUERY_MC, 1);
retval = nl_sock_transact(sock, &request, &reply);
ofpbuf_uninit(&request);
if (retval) {
nl_sock_destroy(sock);
return retval;
}
if (!nl_policy_parse(reply, NLMSG_HDRLEN + GENL_HDRLEN,
brc_multicast_policy, attrs,
ARRAY_SIZE(brc_multicast_policy))) {
nl_sock_destroy(sock);
ofpbuf_delete(reply);
return EPROTO;
}
*multicast_group = nl_attr_get_u32(attrs[BRC_GENL_A_MC_GROUP]);
nl_sock_destroy(sock);
ofpbuf_delete(reply);
return 0;
}
/* Opens a socket for brcompat notifications. Returns 0 if successful,
* otherwise a positive errno value. */
static int
brc_open(struct nl_sock **sock)
{
int multicast_group = 0;
int retval;
retval = nl_lookup_genl_family(BRC_GENL_FAMILY_NAME, &brc_family);
if (retval) {
return retval;
}
retval = lookup_brc_multicast_group(&multicast_group);
if (retval) {
return retval;
}
retval = nl_sock_create(NETLINK_GENERIC, sock);
if (retval) {
return retval;
}
retval = nl_sock_join_mcgroup(*sock, multicast_group);
if (retval) {
nl_sock_destroy(*sock);
*sock = NULL;
}
return retval;
}
static const struct nl_policy brc_dp_policy[] = {
[BRC_GENL_A_DP_NAME] = { .type = NL_A_STRING },
};
static struct ovsrec_bridge *
find_bridge(const struct ovsrec_open_vswitch *ovs, const char *br_name)
{
size_t i;
for (i = 0; i < ovs->n_bridges; i++) {
if (!strcmp(br_name, ovs->bridges[i]->name)) {
return ovs->bridges[i];
}
}
return NULL;
}
static int
execute_appctl_command(const char *unixctl_command, char **output)
{
char *stdout_log, *stderr_log;
int error, status;
char *argv[5];
argv[0] = "/bin/sh";
argv[1] = "-c";
argv[2] = xasprintf(appctl_command, unixctl_command);
argv[3] = NULL;
/* Run process and log status. */
error = process_run_capture(argv, &stdout_log, &stderr_log, &status);
if (error) {
VLOG_ERR("failed to execute %s command via ovs-appctl: %s",
unixctl_command, strerror(error));
} else if (status) {
char *msg = process_status_msg(status);
VLOG_ERR("ovs-appctl exited with error (%s)", msg);
free(msg);
error = ECHILD;
}
/* Deal with stdout_log. */
if (output) {
*output = stdout_log;
} else {
free(stdout_log);
}
/* Deal with stderr_log */
if (stderr_log && *stderr_log) {
VLOG_INFO("ovs-appctl wrote to stderr:\n%s", stderr_log);
}
free(stderr_log);
free(argv[2]);
return error;
}
static void
do_get_bridge_parts(const struct ovsrec_bridge *br, struct sset *parts,
int vlan, bool break_down_bonds)
{
size_t i, j;
for (i = 0; i < br->n_ports; i++) {
const struct ovsrec_port *port = br->ports[i];
if (vlan >= 0) {
int port_vlan = port->n_tag ? *port->tag : 0;
if (vlan != port_vlan) {
continue;
}
}
if (break_down_bonds) {
for (j = 0; j < port->n_interfaces; j++) {
const struct ovsrec_interface *iface = port->interfaces[j];
sset_add(parts, iface->name);
}
} else {
sset_add(parts, port->name);
}
}
}
/* Add all the interfaces for 'bridge' to 'ifaces', breaking bonded interfaces
* down into their constituent parts.
*
* If 'vlan' < 0, all interfaces on 'bridge' are reported. If 'vlan' == 0,
* then only interfaces for trunk ports or ports with implicit VLAN 0 are
* reported. If 'vlan' > 0, only interfaces with implicit VLAN 'vlan' are
* reported. */
static void
get_bridge_ifaces(const struct ovsrec_bridge *br, struct sset *ifaces,
int vlan)
{
do_get_bridge_parts(br, ifaces, vlan, true);
}
/* Add all the ports for 'bridge' to 'ports'. Bonded ports are reported under
* the bond name, not broken down into their constituent interfaces.
*
* If 'vlan' < 0, all ports on 'bridge' are reported. If 'vlan' == 0, then
* only trunk ports or ports with implicit VLAN 0 are reported. If 'vlan' > 0,
* only port with implicit VLAN 'vlan' are reported. */
static void
get_bridge_ports(const struct ovsrec_bridge *br, struct sset *ports,
int vlan)
{
do_get_bridge_parts(br, ports, vlan, false);
}
static struct ovsdb_idl_txn *
txn_from_openvswitch(const struct ovsrec_open_vswitch *ovs)
{
return ovsdb_idl_txn_get(&ovs->header_);
}
static bool
port_is_fake_bridge(const struct ovsrec_port *port)
{
return (port->fake_bridge
&& port->tag
&& *port->tag >= 1 && *port->tag <= 4095);
}
static void
ovs_insert_bridge(const struct ovsrec_open_vswitch *ovs,
struct ovsrec_bridge *bridge)
{
struct ovsrec_bridge **bridges;
size_t i;
bridges = xmalloc(sizeof *ovs->bridges * (ovs->n_bridges + 1));
for (i = 0; i < ovs->n_bridges; i++) {
bridges[i] = ovs->bridges[i];
}
bridges[ovs->n_bridges] = bridge;
ovsrec_open_vswitch_set_bridges(ovs, bridges, ovs->n_bridges + 1);
free(bridges);
}
static struct json *
where_uuid_equals(const struct uuid *uuid)
{
return
json_array_create_1(
json_array_create_3(
json_string_create("_uuid"),
json_string_create("=="),
json_array_create_2(
json_string_create("uuid"),
json_string_create_nocopy(
xasprintf(UUID_FMT, UUID_ARGS(uuid))))));
}
/* Commits 'txn'. If 'wait_for_reload' is true, also waits for Open vSwitch to
reload the configuration before returning.
Returns EAGAIN if the caller should try the operation again, 0 on success,
otherwise a positive errno value. */
static int
commit_txn(struct ovsdb_idl_txn *txn, bool wait_for_reload)
{
struct ovsdb_idl *idl = ovsdb_idl_txn_get_idl (txn);
enum ovsdb_idl_txn_status status;
int64_t next_cfg = 0;
if (wait_for_reload) {
const struct ovsrec_open_vswitch *ovs = ovsrec_open_vswitch_first(idl);
struct json *where = where_uuid_equals(&ovs->header_.uuid);
ovsdb_idl_txn_increment(txn, "Open_vSwitch", "next_cfg", where);
json_destroy(where);
}
status = ovsdb_idl_txn_commit_block(txn);
if (wait_for_reload && status == TXN_SUCCESS) {
next_cfg = ovsdb_idl_txn_get_increment_new_value(txn);
}
ovsdb_idl_txn_destroy(txn);
switch (status) {
case TXN_INCOMPLETE:
NOT_REACHED();
case TXN_ABORTED:
VLOG_ERR_RL(&rl, "OVSDB transaction unexpectedly aborted");
return ECONNABORTED;
case TXN_UNCHANGED:
return 0;
case TXN_SUCCESS:
if (wait_for_reload) {
for (;;) {
/* We can't use 'ovs' any longer because ovsdb_idl_run() can
* destroy it. */
const struct ovsrec_open_vswitch *ovs2;
ovsdb_idl_run(idl);
OVSREC_OPEN_VSWITCH_FOR_EACH (ovs2, idl) {
if (ovs2->cur_cfg >= next_cfg) {
goto done;
}
}
ovsdb_idl_wait(idl);
poll_block();
}
done: ;
}
return 0;
case TXN_TRY_AGAIN:
VLOG_ERR_RL(&rl, "OVSDB transaction needs retry");
return EAGAIN;
case TXN_ERROR:
VLOG_ERR_RL(&rl, "OVSDB transaction failed: %s",
ovsdb_idl_txn_get_error(txn));
return EBUSY;
default:
NOT_REACHED();
}
}
static int
add_bridge(struct ovsdb_idl *idl, const struct ovsrec_open_vswitch *ovs,
const char *br_name)
{
struct ovsrec_bridge *br;
struct ovsrec_port *port;
struct ovsrec_interface *iface;
struct ovsdb_idl_txn *txn;
if (find_bridge(ovs, br_name)) {
VLOG_WARN("addbr %s: bridge %s exists", br_name, br_name);
return EEXIST;
} else if (netdev_exists(br_name)) {
size_t i;
for (i = 0; i < ovs->n_bridges; i++) {
size_t j;
struct ovsrec_bridge *br_cfg = ovs->bridges[i];
for (j = 0; j < br_cfg->n_ports; j++) {
if (port_is_fake_bridge(br_cfg->ports[j])) {
VLOG_WARN("addbr %s: %s exists as a fake bridge",
br_name, br_name);
return 0;
}
}
}
VLOG_WARN("addbr %s: cannot create bridge %s because a network "
"device named %s already exists",
br_name, br_name, br_name);
return EEXIST;
}
txn = ovsdb_idl_txn_create(idl);
ovsdb_idl_txn_add_comment(txn, "ovs-brcompatd: addbr %s", br_name);
iface = ovsrec_interface_insert(txn_from_openvswitch(ovs));
ovsrec_interface_set_name(iface, br_name);
port = ovsrec_port_insert(txn_from_openvswitch(ovs));
ovsrec_port_set_name(port, br_name);
ovsrec_port_set_interfaces(port, &iface, 1);
br = ovsrec_bridge_insert(txn_from_openvswitch(ovs));
ovsrec_bridge_set_name(br, br_name);
ovsrec_bridge_set_ports(br, &port, 1);
ovs_insert_bridge(ovs, br);
return commit_txn(txn, true);
}
static void
add_port(const struct ovsrec_open_vswitch *ovs,
const struct ovsrec_bridge *br, const char *port_name)
{
struct ovsrec_interface *iface;
struct ovsrec_port *port;
struct ovsrec_port **ports;
size_t i;
/* xxx Check conflicts? */
iface = ovsrec_interface_insert(txn_from_openvswitch(ovs));
ovsrec_interface_set_name(iface, port_name);
port = ovsrec_port_insert(txn_from_openvswitch(ovs));
ovsrec_port_set_name(port, port_name);
ovsrec_port_set_interfaces(port, &iface, 1);
ports = xmalloc(sizeof *br->ports * (br->n_ports + 1));
for (i = 0; i < br->n_ports; i++) {
ports[i] = br->ports[i];
}
ports[br->n_ports] = port;
ovsrec_bridge_set_ports(br, ports, br->n_ports + 1);
free(ports);
}
/* Deletes 'port' from 'br'.
*
* After calling this function, 'port' must not be referenced again. */
static void
del_port(const struct ovsrec_bridge *br, const struct ovsrec_port *port)
{
struct ovsrec_port **ports;
size_t i, n;
/* Remove 'port' from the bridge's list of ports. */
ports = xmalloc(sizeof *br->ports * br->n_ports);
for (i = n = 0; i < br->n_ports; i++) {
if (br->ports[i] != port) {
ports[n++] = br->ports[i];
}
}
ovsrec_bridge_set_ports(br, ports, n);
free(ports);
}
/* Delete 'iface' from 'port' (which must be within 'br'). If 'iface' was
* 'port''s only interface, delete 'port' from 'br' also.
*
* After calling this function, 'iface' must not be referenced again. */
static void
del_interface(const struct ovsrec_bridge *br,
const struct ovsrec_port *port,
const struct ovsrec_interface *iface)
{
if (port->n_interfaces == 1) {
del_port(br, port);
} else {
struct ovsrec_interface **ifaces;
size_t i, n;
ifaces = xmalloc(sizeof *port->interfaces * port->n_interfaces);
for (i = n = 0; i < port->n_interfaces; i++) {
if (port->interfaces[i] != iface) {
ifaces[n++] = port->interfaces[i];
}
}
ovsrec_port_set_interfaces(port, ifaces, n);
free(ifaces);
}
}
/* Find and return a port within 'br' named 'port_name'. */
static const struct ovsrec_port *
find_port(const struct ovsrec_bridge *br, const char *port_name)
{
size_t i;
for (i = 0; i < br->n_ports; i++) {
struct ovsrec_port *port = br->ports[i];
if (!strcmp(port_name, port->name)) {
return port;
}
}
return NULL;
}
/* Find and return an interface within 'br' named 'iface_name'. */
static const struct ovsrec_interface *
find_interface(const struct ovsrec_bridge *br, const char *iface_name,
struct ovsrec_port **portp)
{
size_t i;
for (i = 0; i < br->n_ports; i++) {
struct ovsrec_port *port = br->ports[i];
size_t j;
for (j = 0; j < port->n_interfaces; j++) {
struct ovsrec_interface *iface = port->interfaces[j];
if (!strcmp(iface->name, iface_name)) {
*portp = port;
return iface;
}
}
}
*portp = NULL;
return NULL;
}
static int
del_bridge(struct ovsdb_idl *idl,
const struct ovsrec_open_vswitch *ovs, const char *br_name)
{
struct ovsrec_bridge *br = find_bridge(ovs, br_name);
struct ovsrec_bridge **bridges;
struct ovsdb_idl_txn *txn;
size_t i, n;
if (!br) {
VLOG_WARN("delbr %s: no bridge named %s", br_name, br_name);
return ENXIO;
}
txn = ovsdb_idl_txn_create(idl);
ovsdb_idl_txn_add_comment(txn, "ovs-brcompatd: delbr %s", br_name);
/* Remove 'br' from the vswitch's list of bridges. */
bridges = xmalloc(sizeof *ovs->bridges * ovs->n_bridges);
for (i = n = 0; i < ovs->n_bridges; i++) {
if (ovs->bridges[i] != br) {
bridges[n++] = ovs->bridges[i];
}
}
ovsrec_open_vswitch_set_bridges(ovs, bridges, n);
free(bridges);
return commit_txn(txn, true);
}
static int
parse_command(struct ofpbuf *buffer, uint32_t *seq, const char **br_name,
const char **port_name, uint64_t *count, uint64_t *skip)
{
static const struct nl_policy policy[] = {
[BRC_GENL_A_DP_NAME] = { .type = NL_A_STRING, .optional = true },
[BRC_GENL_A_PORT_NAME] = { .type = NL_A_STRING, .optional = true },
[BRC_GENL_A_FDB_COUNT] = { .type = NL_A_U64, .optional = true },
[BRC_GENL_A_FDB_SKIP] = { .type = NL_A_U64, .optional = true },
};
struct nlattr *attrs[ARRAY_SIZE(policy)];
if (!nl_policy_parse(buffer, NLMSG_HDRLEN + GENL_HDRLEN, policy,
attrs, ARRAY_SIZE(policy))
|| (br_name && !attrs[BRC_GENL_A_DP_NAME])
|| (port_name && !attrs[BRC_GENL_A_PORT_NAME])
|| (count && !attrs[BRC_GENL_A_FDB_COUNT])
|| (skip && !attrs[BRC_GENL_A_FDB_SKIP])) {
return EINVAL;
}
*seq = ((struct nlmsghdr *) buffer->data)->nlmsg_seq;
if (br_name) {
*br_name = nl_attr_get_string(attrs[BRC_GENL_A_DP_NAME]);
}
if (port_name) {
*port_name = nl_attr_get_string(attrs[BRC_GENL_A_PORT_NAME]);
}
if (count) {
*count = nl_attr_get_u64(attrs[BRC_GENL_A_FDB_COUNT]);
}
if (skip) {
*skip = nl_attr_get_u64(attrs[BRC_GENL_A_FDB_SKIP]);
}
return 0;
}
/* Composes and returns a reply to a request made by the datapath with Netlink
* sequence number 'seq' and error code 'error'. The caller may add additional
* attributes to the message, then it may send it with send_reply(). */
static struct ofpbuf *
compose_reply(uint32_t seq, int error)
{
struct ofpbuf *reply = ofpbuf_new(4096);
nl_msg_put_genlmsghdr(reply, 32, brc_family, NLM_F_REQUEST,
BRC_GENL_C_DP_RESULT, 1);
((struct nlmsghdr *) reply->data)->nlmsg_seq = seq;
nl_msg_put_u32(reply, BRC_GENL_A_ERR_CODE, error);
return reply;
}
/* Sends 'reply' to the datapath and frees it. */
static void
send_reply(struct ofpbuf *reply)
{
int retval = nl_sock_send(brc_sock, reply, false);
if (retval) {
VLOG_WARN_RL(&rl, "replying to brcompat request: %s",
strerror(retval));
}
ofpbuf_delete(reply);
}
/* Composes and sends a reply to a request made by the datapath with Netlink
* sequence number 'seq' and error code 'error'. */
static void
send_simple_reply(uint32_t seq, int error)
{
send_reply(compose_reply(seq, error));
}
static int
handle_bridge_cmd(struct ovsdb_idl *idl,
const struct ovsrec_open_vswitch *ovs,
struct ofpbuf *buffer, bool add)
{
const char *br_name;
uint32_t seq;
int error;
error = parse_command(buffer, &seq, &br_name, NULL, NULL, NULL);
if (!error) {
int retval;
do {
retval = (add ? add_bridge : del_bridge)(idl, ovs, br_name);
VLOG_INFO_RL(&rl, "%sbr %s: %s",
add ? "add" : "del", br_name, strerror(retval));
} while (retval == EAGAIN);
send_simple_reply(seq, error);
}
return error;
}
static const struct nl_policy brc_port_policy[] = {
[BRC_GENL_A_DP_NAME] = { .type = NL_A_STRING },
[BRC_GENL_A_PORT_NAME] = { .type = NL_A_STRING },
};
static int
handle_port_cmd(struct ovsdb_idl *idl,
const struct ovsrec_open_vswitch *ovs,
struct ofpbuf *buffer, bool add)
{
const char *cmd_name = add ? "add-if" : "del-if";
const char *br_name, *port_name;
uint32_t seq;
int error;
error = parse_command(buffer, &seq, &br_name, &port_name, NULL, NULL);
if (!error) {
struct ovsrec_bridge *br = find_bridge(ovs, br_name);
if (!br) {
VLOG_WARN("%s %s %s: no bridge named %s",
cmd_name, br_name, port_name, br_name);
error = EINVAL;
} else if (!netdev_exists(port_name)) {
VLOG_WARN("%s %s %s: no network device named %s",
cmd_name, br_name, port_name, port_name);
error = EINVAL;
} else {
do {
struct ovsdb_idl_txn *txn = ovsdb_idl_txn_create(idl);
if (add) {
ovsdb_idl_txn_add_comment(txn, "ovs-brcompatd: add-if %s",
port_name);
add_port(ovs, br, port_name);
} else {
const struct ovsrec_port *port = find_port(br, port_name);
if (port) {
ovsdb_idl_txn_add_comment(txn,
"ovs-brcompatd: del-if %s",
port_name);
del_port(br, port);
}
}
error = commit_txn(txn, true);
VLOG_INFO_RL(&rl, "%s %s %s: %s",
cmd_name, br_name, port_name, strerror(error));
} while (error == EAGAIN);
}
send_simple_reply(seq, error);
}
return error;
}
/* The caller is responsible for freeing '*ovs_name' if the call is
* successful. */
static int
linux_bridge_to_ovs_bridge(const struct ovsrec_open_vswitch *ovs,
const char *linux_name,
const struct ovsrec_bridge **ovs_bridge,
int *br_vlan)
{
*ovs_bridge = find_bridge(ovs, linux_name);
if (*ovs_bridge) {
/* Bridge name is the same. We are interested in VLAN 0. */
*br_vlan = 0;
return 0;
} else {
/* No such Open vSwitch bridge 'linux_name', but there might be an
* internal port named 'linux_name' on some other bridge
* 'ovs_bridge'. If so then we are interested in the VLAN assigned to
* port 'linux_name' on the bridge named 'ovs_bridge'. */
size_t i, j;
for (i = 0; i < ovs->n_bridges; i++) {
const struct ovsrec_bridge *br = ovs->bridges[i];
for (j = 0; j < br->n_ports; j++) {
const struct ovsrec_port *port = br->ports[j];
if (!strcmp(port->name, linux_name)) {
*ovs_bridge = br;
*br_vlan = port->n_tag ? *port->tag : -1;
return 0;
}
}
}
return ENODEV;
}
}
static int
handle_fdb_query_cmd(const struct ovsrec_open_vswitch *ovs,
struct ofpbuf *buffer)
{
/* This structure is copied directly from the Linux 2.6.30 header files.
* It would be more straightforward to #include <linux/if_bridge.h>, but
* the 'port_hi' member was only introduced in Linux 2.6.26 and so systems
* with old header files won't have it. */
struct __fdb_entry {
__u8 mac_addr[6];
__u8 port_no;
__u8 is_local;
__u32 ageing_timer_value;
__u8 port_hi;
__u8 pad0;
__u16 unused;
};
struct mac {
uint8_t addr[6];
};
struct mac *local_macs;
int n_local_macs;
int i;
/* Impedance matching between the vswitchd and Linux kernel notions of what
* a bridge is. The kernel only handles a single VLAN per bridge, but
* vswitchd can deal with all the VLANs on a single bridge. We have to
* pretend that the former is the case even though the latter is the
* implementation. */
const char *linux_name; /* Name used by brctl. */
const struct ovsrec_bridge *ovs_bridge; /* Bridge used by ovs-vswitchd. */
int br_vlan; /* VLAN tag. */
struct sset ifaces;
struct ofpbuf query_data;
const char *iface_name;
struct ofpbuf *reply;
char *unixctl_command;
uint64_t count, skip;
char *output;
char *save_ptr;
uint32_t seq;
int error;
/* Parse the command received from brcompat_mod. */
error = parse_command(buffer, &seq, &linux_name, NULL, &count, &skip);
if (error) {
return error;
}
/* Figure out vswitchd bridge and VLAN. */
error = linux_bridge_to_ovs_bridge(ovs, linux_name,
&ovs_bridge, &br_vlan);
if (error) {
send_simple_reply(seq, error);
return error;
}
/* Fetch the forwarding database using ovs-appctl. */
unixctl_command = xasprintf("fdb/show %s", ovs_bridge->name);
error = execute_appctl_command(unixctl_command, &output);
free(unixctl_command);
if (error) {
send_simple_reply(seq, error);
return error;
}
/* Fetch the MAC address for each interface on the bridge, so that we can
* fill in the is_local field in the response. */
sset_init(&ifaces);
get_bridge_ifaces(ovs_bridge, &ifaces, br_vlan);
local_macs = xmalloc(sset_count(&ifaces) * sizeof *local_macs);
n_local_macs = 0;
SSET_FOR_EACH (iface_name, &ifaces) {
struct mac *mac = &local_macs[n_local_macs];
struct netdev *netdev;
error = netdev_open_default(iface_name, &netdev);
if (!error) {
if (!netdev_get_etheraddr(netdev, mac->addr)) {
n_local_macs++;
}
netdev_close(netdev);
}
}
sset_destroy(&ifaces);
/* Parse the response from ovs-appctl and convert it to binary format to
* pass back to the kernel. */
ofpbuf_init(&query_data, sizeof(struct __fdb_entry) * 8);
save_ptr = NULL;
strtok_r(output, "\n", &save_ptr); /* Skip header line. */
while (count > 0) {
struct __fdb_entry *entry;
int port, vlan, age;
uint8_t mac[ETH_ADDR_LEN];
char *line;
bool is_local;
line = strtok_r(NULL, "\n", &save_ptr);
if (!line) {
break;
}
if (sscanf(line, "%d %d "ETH_ADDR_SCAN_FMT" %d",
&port, &vlan, ETH_ADDR_SCAN_ARGS(mac), &age)
!= 2 + ETH_ADDR_SCAN_COUNT + 1) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
VLOG_INFO_RL(&rl, "fdb/show output has invalid format: %s", line);
continue;
}
if (vlan != br_vlan) {
continue;
}
if (skip > 0) {
skip--;
continue;
}
/* Is this the MAC address of an interface on the bridge? */
is_local = false;
for (i = 0; i < n_local_macs; i++) {
if (eth_addr_equals(local_macs[i].addr, mac)) {
is_local = true;
break;
}
}
entry = ofpbuf_put_uninit(&query_data, sizeof *entry);
memcpy(entry->mac_addr, mac, ETH_ADDR_LEN);
entry->port_no = port & 0xff;
entry->is_local = is_local;
entry->ageing_timer_value = age * HZ;
entry->port_hi = (port & 0xff00) >> 8;
entry->pad0 = 0;
entry->unused = 0;
count--;
}
free(output);
/* Compose and send reply to datapath. */
reply = compose_reply(seq, 0);
nl_msg_put_unspec(reply, BRC_GENL_A_FDB_DATA,
query_data.data, query_data.size);
send_reply(reply);
/* Free memory. */
ofpbuf_uninit(&query_data);
free(local_macs);
return 0;
}
static void
send_ifindex_reply(uint32_t seq, struct sset *ifaces)
{
struct ofpbuf *reply;
const char *iface;
size_t n_indices;
int *indices;
/* Convert 'ifaces' into ifindexes. */
n_indices = 0;
indices = xmalloc(sset_count(ifaces) * sizeof *indices);
SSET_FOR_EACH (iface, ifaces) {
int ifindex = if_nametoindex(iface);
if (ifindex) {
indices[n_indices++] = ifindex;
}
}
/* Compose and send reply. */
reply = compose_reply(seq, 0);
nl_msg_put_unspec(reply, BRC_GENL_A_IFINDEXES,
indices, n_indices * sizeof *indices);
send_reply(reply);
/* Free memory. */
free(indices);
}
static int
handle_get_bridges_cmd(const struct ovsrec_open_vswitch *ovs,
struct ofpbuf *buffer)
{
struct sset bridges;
size_t i, j;
uint32_t seq;
int error;
/* Parse Netlink command.
*
* The command doesn't actually have any arguments, but we need the
* sequence number to send the reply. */
error = parse_command(buffer, &seq, NULL, NULL, NULL, NULL);
if (error) {
return error;
}
/* Get all the real bridges and all the fake ones. */
sset_init(&bridges);
for (i = 0; i < ovs->n_bridges; i++) {
const struct ovsrec_bridge *br = ovs->bridges[i];
sset_add(&bridges, br->name);
for (j = 0; j < br->n_ports; j++) {
const struct ovsrec_port *port = br->ports[j];
if (port->fake_bridge) {
sset_add(&bridges, port->name);
}
}
}
send_ifindex_reply(seq, &bridges);
sset_destroy(&bridges);
return 0;
}
static int
handle_get_ports_cmd(const struct ovsrec_open_vswitch *ovs,
struct ofpbuf *buffer)
{
uint32_t seq;
const char *linux_name;
const struct ovsrec_bridge *ovs_bridge;
int br_vlan;
struct sset ports;
int error;
/* Parse Netlink command. */
error = parse_command(buffer, &seq, &linux_name, NULL, NULL, NULL);
if (error) {
return error;
}
error = linux_bridge_to_ovs_bridge(ovs, linux_name,
&ovs_bridge, &br_vlan);
if (error) {
send_simple_reply(seq, error);
return error;
}
sset_init(&ports);
get_bridge_ports(ovs_bridge, &ports, br_vlan);
sset_find_and_delete(&ports, linux_name);
send_ifindex_reply(seq, &ports); /* XXX bonds won't show up */
sset_destroy(&ports);
return 0;
}
static struct ofpbuf *
brc_recv_update__(void)
{
for (;;) {
struct ofpbuf *buffer;
int retval;
retval = nl_sock_recv(brc_sock, &buffer, false);
switch (retval) {
case 0:
if (nl_msg_nlmsgerr(buffer, NULL)
|| nl_msg_nlmsghdr(buffer)->nlmsg_type == NLMSG_DONE) {
break;
}
return buffer;
case ENOBUFS:
break;
case EAGAIN:
return NULL;
default:
VLOG_WARN_RL(&rl, "brc_recv_update: %s", strerror(retval));
return NULL;
}
ofpbuf_delete(buffer);
}
}
static void
brc_recv_update(struct ovsdb_idl *idl)
{
struct ofpbuf *buffer;
struct genlmsghdr *genlmsghdr;
const struct ovsrec_open_vswitch *ovs;
buffer = brc_recv_update__();
if (!buffer) {
return;
}
genlmsghdr = nl_msg_genlmsghdr(buffer);
if (!genlmsghdr) {
VLOG_WARN_RL(&rl, "received packet too short for generic NetLink");
goto error;
}
if (nl_msg_nlmsghdr(buffer)->nlmsg_type != brc_family) {
VLOG_DBG_RL(&rl, "received type (%"PRIu16") != brcompat family (%d)",
nl_msg_nlmsghdr(buffer)->nlmsg_type, brc_family);
goto error;
}
/* Get the Open vSwitch configuration. Just drop the request on the floor
* if a valid configuration doesn't exist. (We could check this earlier,
* but we want to drain pending Netlink messages even when there is no Open
* vSwitch configuration.) */
ovs = ovsrec_open_vswitch_first(idl);
if (!ovs) {
VLOG_WARN_RL(&rl, "could not find valid configuration to update");
goto error;
}
switch (genlmsghdr->cmd) {
case BRC_GENL_C_DP_ADD:
handle_bridge_cmd(idl, ovs, buffer, true);
break;
case BRC_GENL_C_DP_DEL:
handle_bridge_cmd(idl, ovs, buffer, false);
break;
case BRC_GENL_C_PORT_ADD:
handle_port_cmd(idl, ovs, buffer, true);
break;
case BRC_GENL_C_PORT_DEL:
handle_port_cmd(idl, ovs, buffer, false);
break;
case BRC_GENL_C_FDB_QUERY:
handle_fdb_query_cmd(ovs, buffer);
break;
case BRC_GENL_C_GET_BRIDGES:
handle_get_bridges_cmd(ovs, buffer);
break;
case BRC_GENL_C_GET_PORTS:
handle_get_ports_cmd(ovs, buffer);
break;
default:
VLOG_WARN_RL(&rl, "received unknown brc netlink command: %d\n",
genlmsghdr->cmd);
break;
}
error:
ofpbuf_delete(buffer);
return;
}
/* Check for interface configuration changes announced through RTNL. */
static void
rtnl_recv_update(struct ovsdb_idl *idl,
const struct ovsrec_open_vswitch *ovs)
{
struct ofpbuf *buf;
int error = nl_sock_recv(rtnl_sock, &buf, false);
if (error == EAGAIN) {
/* Nothing to do. */
} else if (error == ENOBUFS) {
VLOG_WARN_RL(&rl, "network monitor socket overflowed");
} else if (error) {
VLOG_WARN_RL(&rl, "error on network monitor socket: %s",
strerror(error));
} else {
struct nlattr *attrs[ARRAY_SIZE(rtnlgrp_link_policy)];
struct nlmsghdr *nlh;
struct ifinfomsg *iim;
nlh = ofpbuf_at(buf, 0, NLMSG_HDRLEN);
iim = ofpbuf_at(buf, NLMSG_HDRLEN, sizeof *iim);
if (!iim) {
VLOG_WARN_RL(&rl, "received bad rtnl message (no ifinfomsg)");
ofpbuf_delete(buf);
return;
}
if (!nl_policy_parse(buf, NLMSG_HDRLEN + sizeof(struct ifinfomsg),
rtnlgrp_link_policy,
attrs, ARRAY_SIZE(rtnlgrp_link_policy))) {
VLOG_WARN_RL(&rl,"received bad rtnl message (policy)");
ofpbuf_delete(buf);
return;
}
if (nlh->nlmsg_type == RTM_DELLINK && attrs[IFLA_MASTER]) {
const char *port_name = nl_attr_get_string(attrs[IFLA_IFNAME]);
char br_name[IFNAMSIZ];
uint32_t br_idx = nl_attr_get_u32(attrs[IFLA_MASTER]);
if (!if_indextoname(br_idx, br_name)) {
ofpbuf_delete(buf);
return;
}
if (!netdev_exists(port_name)) {
/* Network device is really gone. */
struct ovsdb_idl_txn *txn;
const struct ovsrec_interface *iface;
struct ovsrec_port *port;
struct ovsrec_bridge *br;
VLOG_INFO("network device %s destroyed, "
"removing from bridge %s", port_name, br_name);
br = find_bridge(ovs, br_name);
if (!br) {
VLOG_WARN("no bridge named %s from which to remove %s",
br_name, port_name);
ofpbuf_delete(buf);
return;
}
txn = ovsdb_idl_txn_create(idl);
iface = find_interface(br, port_name, &port);
if (iface) {
del_interface(br, port, iface);
ovsdb_idl_txn_add_comment(txn,
"ovs-brcompatd: destroy port %s",
port_name);
}
commit_txn(txn, false);
} else {
/* A network device by that name exists even though the kernel
* told us it had disappeared. Probably, what happened was
* this:
*
* 1. Device destroyed.
* 2. Notification sent to us.
* 3. New device created with same name as old one.
* 4. ovs-brcompatd notified, removes device from bridge.
*
* There's no a priori reason that in this situation that the
* new device with the same name should remain in the bridge;
* on the contrary, that would be unexpected. *But* there is
* one important situation where, if we do this, bad things
* happen. This is the case of XenServer Tools version 5.0.0,
* which on boot of a Windows VM cause something like this to
* happen on the Xen host:
*
* i. Create tap1.0 and vif1.0.
* ii. Delete tap1.0.
* iii. Delete vif1.0.
* iv. Re-create vif1.0.
*
* (XenServer Tools 5.5.0 does not exhibit this behavior, and
* neither does a VM without Tools installed at all.@.)
*
* Steps iii and iv happen within a few seconds of each other.
* Step iv causes /etc/xensource/scripts/vif to run, which in
* turn calls ovs-cfg-mod to add the new device to the bridge.
* If step iv happens after step 4 (in our first list of
* steps), then all is well, but if it happens between 3 and 4
* (which can easily happen if ovs-brcompatd has to wait to
* lock the configuration file), then we will remove the new
* incarnation from the bridge instead of the old one!
*
* So, to avoid this problem, we do nothing here. This is
* strictly incorrect except for this one particular case, and
* perhaps that will bite us someday. If that happens, then we
* will have to somehow track network devices by ifindex, since
* a new device will have a new ifindex even if it has the same
* name as an old device.
*/
VLOG_INFO("kernel reported network device %s removed but "
"a device by that name exists (XS Tools 5.0.0?)",
port_name);
}
}
ofpbuf_delete(buf);
}
}
int
main(int argc, char *argv[])
{
extern struct vlog_module VLM_reconnect;
struct unixctl_server *unixctl;
const char *remote;
struct ovsdb_idl *idl;
int retval;
proctitle_init(argc, argv);
set_program_name(argv[0]);
vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
vlog_set_levels(&VLM_reconnect, VLF_ANY_FACILITY, VLL_WARN);
remote = parse_options(argc, argv);
signal(SIGPIPE, SIG_IGN);
process_init();
ovsrec_init();
daemonize_start();
retval = unixctl_server_create(NULL, &unixctl);
if (retval) {
exit(EXIT_FAILURE);
}
if (brc_open(&brc_sock)) {
VLOG_FATAL("could not open brcompat socket. Check "
"\"brcompat\" kernel module.");
}
if (prune_timeout) {
int error;
error = nl_sock_create(NETLINK_ROUTE, &rtnl_sock);
if (error) {
VLOG_FATAL("could not create rtnetlink socket (%s)",
strerror(error));
}
error = nl_sock_join_mcgroup(rtnl_sock, RTNLGRP_LINK);
if (error) {
VLOG_FATAL("could not join RTNLGRP_LINK multicast group (%s)",
strerror(error));
}
}
daemonize_complete();
idl = ovsdb_idl_create(remote, &ovsrec_idl_class, true);
for (;;) {
const struct ovsrec_open_vswitch *ovs;
ovsdb_idl_run(idl);
unixctl_server_run(unixctl);
brc_recv_update(idl);
ovs = ovsrec_open_vswitch_first(idl);
if (!ovs && ovsdb_idl_has_ever_connected(idl)) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
VLOG_WARN_RL(&rl, "%s: database does not contain any Open vSwitch "
"configuration", remote);
}
netdev_run();
/* If 'prune_timeout' is non-zero, we actively prune from the
* configuration of port entries that are no longer valid. We
* use two methods:
*
* 1) The kernel explicitly notifies us of removed ports
* through the RTNL messages.
*
* 2) We periodically check all ports associated with bridges
* to see if they no longer exist.
*/
if (ovs && prune_timeout) {
rtnl_recv_update(idl, ovs);
nl_sock_wait(rtnl_sock, POLLIN);
poll_timer_wait(prune_timeout);
}
nl_sock_wait(brc_sock, POLLIN);
ovsdb_idl_wait(idl);
unixctl_server_wait(unixctl);
netdev_wait();
poll_block();
}
ovsdb_idl_destroy(idl);
return 0;
}
static void
validate_appctl_command(void)
{
const char *p;
int n;
n = 0;
for (p = strchr(appctl_command, '%'); p; p = strchr(p + 2, '%')) {
if (p[1] == '%') {
/* Nothing to do. */
} else if (p[1] == 's') {
n++;
} else {
VLOG_FATAL("only '%%s' and '%%%%' allowed in --appctl-command");
}
}
if (n != 1) {
VLOG_FATAL("'%%s' must appear exactly once in --appctl-command");
}
}
static const char *
parse_options(int argc, char *argv[])
{
enum {
OPT_PRUNE_TIMEOUT,
OPT_APPCTL_COMMAND,
VLOG_OPTION_ENUMS,
LEAK_CHECKER_OPTION_ENUMS,
DAEMON_OPTION_ENUMS
};
static struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{"prune-timeout", required_argument, 0, OPT_PRUNE_TIMEOUT},
{"appctl-command", required_argument, 0, OPT_APPCTL_COMMAND},
DAEMON_LONG_OPTIONS,
VLOG_LONG_OPTIONS,
LEAK_CHECKER_LONG_OPTIONS,
{0, 0, 0, 0},
};
char *short_options = long_options_to_short_options(long_options);
appctl_command = xasprintf("%s/ovs-appctl %%s", ovs_bindir());
for (;;) {
int c;
c = getopt_long(argc, argv, short_options, long_options, NULL);
if (c == -1) {
break;
}
switch (c) {
case 'H':
case 'h':
usage();
case 'V':
OVS_PRINT_VERSION(0, 0);
exit(EXIT_SUCCESS);
case OPT_PRUNE_TIMEOUT:
prune_timeout = atoi(optarg) * 1000;
break;
case OPT_APPCTL_COMMAND:
appctl_command = optarg;
break;
VLOG_OPTION_HANDLERS
DAEMON_OPTION_HANDLERS
LEAK_CHECKER_OPTION_HANDLERS
case '?':
exit(EXIT_FAILURE);
default:
abort();
}
}
free(short_options);
validate_appctl_command();
argc -= optind;
argv += optind;
if (argc != 1) {
VLOG_FATAL("database socket is non-option argument; "
"use --help for usage");
}
return argv[0];
}
static void
usage(void)
{
printf("%s: bridge compatibility front-end for ovs-vswitchd\n"
"usage: %s [OPTIONS] CONFIG\n"
"CONFIG is the configuration file used by ovs-vswitchd.\n",
program_name, program_name);
printf("\nConfiguration options:\n"
" --appctl-command=COMMAND shell command to run ovs-appctl\n"
" --prune-timeout=SECS wait at most SECS before pruning ports\n"
);
daemon_usage();
vlog_usage();
printf("\nOther options:\n"
" -h, --help display this help message\n"
" -V, --version display version information\n");
leak_checker_usage();
printf("\nThe default appctl command is:\n%s\n", appctl_command);
exit(EXIT_SUCCESS);
}
|
lesserwhirls/scipy-cwt | scipy/weave/blitz/blitz/vecexpr.h | // -*- C++ -*-
/***************************************************************************
* blitz/vecexpr.h Vector<P_numtype> expression templates
*
* $Id: vecexpr.h 1414 2005-11-01 22:04:59Z cookedm $
*
* Copyright (C) 1997-2001 <NAME> <<EMAIL>>
*
* This code was relicensed under the modified BSD license for use in SciPy
* by <NAME> (see LICENSE.txt in the weave directory).
*
*
* Suggestions: <EMAIL>
* Bugs: <EMAIL>
*
* For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/
*
***************************************************************************/
#ifndef BZ_VECEXPR_H
#define BZ_VECEXPR_H
#include <blitz/vector.h>
#include <blitz/applics.h>
#include <blitz/meta/metaprog.h>
#include <blitz/vecexprwrap.h> // _bz_VecExpr wrapper class
BZ_NAMESPACE(blitz)
template<typename P_expr1, typename P_expr2, typename P_op>
class _bz_VecExprOp {
public:
typedef P_expr1 T_expr1;
typedef P_expr2 T_expr2;
typedef _bz_typename T_expr1::T_numtype T_numtype1;
typedef _bz_typename T_expr2::T_numtype T_numtype2;
typedef BZ_PROMOTE(T_numtype1, T_numtype2) T_numtype;
typedef P_op T_op;
#ifdef BZ_PASS_EXPR_BY_VALUE
_bz_VecExprOp(T_expr1 a, T_expr2 b)
: iter1_(a), iter2_(b)
{ }
#else
_bz_VecExprOp(const T_expr1& a, const T_expr2& b)
: iter1_(a), iter2_(b)
{ }
#endif
#ifdef BZ_MANUAL_VECEXPR_COPY_CONSTRUCTOR
_bz_VecExprOp(const _bz_VecExprOp<P_expr1, P_expr2, P_op>& x)
: iter1_(x.iter1_), iter2_(x.iter2_)
{ }
#endif
T_numtype operator[](int i) const
{ return T_op::apply(iter1_[i], iter2_[i]); }
T_numtype operator()(int i) const
{ return T_op::apply(iter1_(i), iter2_(i)); }
int length(int recommendedLength) const
{
BZPRECONDITION(iter2_.length(recommendedLength) ==
iter1_.length(recommendedLength));
return iter1_.length(recommendedLength);
}
static const int
_bz_staticLengthCount = P_expr1::_bz_staticLengthCount
+ P_expr2::_bz_staticLengthCount,
_bz_dynamicLengthCount = P_expr1::_bz_dynamicLengthCount
+ P_expr2::_bz_dynamicLengthCount,
_bz_staticLength =
(P_expr1::_bz_staticLength > P_expr2::_bz_staticLength) ?
P_expr1::_bz_staticLength : P_expr2::_bz_staticLength;
// _bz_meta_max<P_expr1::_bz_staticLength, P_expr2::_bz_staticLength>::max
int _bz_suggestLength() const
{
int length1 = iter1_._bz_suggestLength();
if (length1 != 0)
return length1;
return iter2_._bz_suggestLength();
}
bool _bz_hasFastAccess() const
{ return iter1_._bz_hasFastAccess() && iter2_._bz_hasFastAccess(); }
T_numtype _bz_fastAccess(int i) const
{
return T_op::apply(iter1_._bz_fastAccess(i),
iter2_._bz_fastAccess(i));
}
private:
_bz_VecExprOp();
T_expr1 iter1_;
T_expr2 iter2_;
};
template<typename P_expr, typename P_unaryOp>
class _bz_VecExprUnaryOp {
public:
typedef P_expr T_expr;
typedef P_unaryOp T_unaryOp;
typedef _bz_typename T_unaryOp::T_numtype T_numtype;
#ifdef BZ_PASS_EXPR_BY_VALUE
_bz_VecExprUnaryOp(T_expr iter)
: iter_(iter)
{ }
#else
_bz_VecExprUnaryOp(const T_expr& iter)
: iter_(iter)
{ }
#endif
#ifdef BZ_MANUAL_VECEXPR_COPY_CONSTRUCTOR
_bz_VecExprUnaryOp(const _bz_VecExprUnaryOp<P_expr, P_unaryOp>& x)
: iter_(x.iter_)
{ }
#endif
T_numtype operator[](int i) const
{ return T_unaryOp::apply(iter_[i]); }
T_numtype operator()(int i) const
{ return T_unaryOp::apply(iter_(i)); }
int length(int recommendedLength) const
{ return iter_.length(recommendedLength); }
static const int
_bz_staticLengthCount = P_expr::_bz_staticLengthCount,
_bz_dynamicLengthCount = P_expr::_bz_dynamicLengthCount,
_bz_staticLength = P_expr::_bz_staticLength;
int _bz_suggestLength() const
{ return iter_._bz_suggestLength(); }
bool _bz_hasFastAccess() const
{ return iter_._bz_hasFastAccess(); }
T_numtype _bz_fastAccess(int i) const
{ return T_unaryOp::apply(iter_._bz_fastAccess(i)); }
private:
_bz_VecExprUnaryOp() { }
T_expr iter_;
};
template<typename P_numtype>
class _bz_VecExprConstant {
public:
typedef P_numtype T_numtype;
_bz_VecExprConstant(P_numtype value)
: value_(BZ_NO_PROPAGATE(value))
{
}
#ifdef BZ_MANUAL_VECEXPR_COPY_CONSTRUCTOR
_bz_VecExprConstant(const _bz_VecExprConstant<P_numtype>& x)
: value_(x.value_)
{ }
#endif
T_numtype operator[](int) const
{ return value_; }
T_numtype operator()(int) const
{ return value_; }
int length(int recommendedLength) const
{ return recommendedLength; }
static const int
_bz_staticLengthCount = 0,
_bz_dynamicLengthCount = 0,
_bz_staticLength = 0;
int _bz_suggestLength() const
{ return 0; }
bool _bz_hasFastAccess() const
{ return 1; }
T_numtype _bz_fastAccess(int) const
{ return value_; }
private:
_bz_VecExprConstant() { }
T_numtype value_;
};
BZ_NAMESPACE_END
#ifndef BZ_TINYVEC_H
#include <blitz/tinyvec.h>
#endif
BZ_NAMESPACE(blitz)
// Some miscellaneous operators that don't seem to belong anywhere else.
template<typename P_expr>
inline
_bz_VecExpr<_bz_VecExprUnaryOp<_bz_VecExpr<P_expr>,
_bz_negate<_bz_typename P_expr::T_numtype> > >
operator-(_bz_VecExpr<P_expr> a)
{
typedef _bz_VecExprUnaryOp<_bz_VecExpr<P_expr>,
_bz_negate<_bz_typename P_expr::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(a));
}
template<typename P_numtype>
inline
_bz_VecExpr<_bz_VecExprUnaryOp<VectorIterConst<P_numtype>,
_bz_negate<P_numtype> > >
operator-(const Vector<P_numtype>& a)
{
typedef _bz_VecExprUnaryOp<VectorIterConst<P_numtype>,
_bz_negate<P_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(a.beginFast()));
}
inline
_bz_VecExpr<_bz_VecExprUnaryOp<Range, _bz_negate<Range::T_numtype> > >
operator-(Range r)
{
typedef _bz_VecExprUnaryOp<Range, _bz_negate<Range::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(r));
}
template<typename P_numtype>
inline
_bz_VecExpr<_bz_VecExprUnaryOp<VectorPickIterConst<P_numtype>,
_bz_negate<P_numtype> > >
operator-(const VectorPick<P_numtype>& a)
{
typedef _bz_VecExprUnaryOp<VectorPickIterConst<P_numtype>,
_bz_negate<P_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(a.beginFast()));
}
template<typename P_numtype, int N_length>
inline
_bz_VecExpr<_bz_VecExprUnaryOp<TinyVectorIterConst<P_numtype,N_length>,
_bz_negate<P_numtype> > >
operator-(const TinyVector<P_numtype,N_length>& a)
{
typedef _bz_VecExprUnaryOp<TinyVectorIterConst<P_numtype,N_length>,
_bz_negate<P_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(a.beginFast()));
}
BZ_NAMESPACE_END
#endif // BZ_VECEXPR_H
|
maroozm/AliPhysics | PWGGA/CaloTrackCorrelations/AliAnaParticlePartonCorrelation.cxx | /**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: The ALICE Off-line Project. *
* Contributors are mentioned in the code where appropriate. *
* *
* Permission to use, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
* without fee, provided that the above copyright notice appears in all *
* copies and that both the copyright notice and this permission notice *
* appear in the supporting documentation. The authors make no claims *
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
// --- ROOT system ---
#include "TH2F.h"
#include "TClass.h"
//---- ANALYSIS system ----
#include "AliAnaParticlePartonCorrelation.h"
#include "AliMCEvent.h"
#include "AliCaloTrackParticleCorrelation.h"
#include "AliVParticle.h"
/// \cond CLASSIMP
ClassImp(AliAnaParticlePartonCorrelation) ;
/// \endcond
//________________________________________________________________
/// Default Constructor. Initialize parameters.
//________________________________________________________________
AliAnaParticlePartonCorrelation::AliAnaParticlePartonCorrelation() :
AliAnaCaloTrackCorrBaseClass(),
fhDeltaEtaNearParton(0), fhDeltaPhiNearParton(0),
fhDeltaPtNearParton(0), fhPtRatNearParton(0),
fhDeltaEtaAwayParton(0), fhDeltaPhiAwayParton(0),
fhDeltaPtAwayParton(0), fhPtRatAwayParton(0)
{
InitParameters();
}
//________________________________________________________________
/// Create histograms to be saved in output file.
//________________________________________________________________
TList * AliAnaParticlePartonCorrelation::GetCreateOutputObjects()
{
TList * outputContainer = new TList() ;
outputContainer->SetName("ParticlePartonHistos") ;
fhDeltaPhiNearParton = new TH2F
("DeltaPhiNearParton","#phi_{particle} - #phi_{parton} vs p_{T particle}",
200,0,120,200,0,6.4);
fhDeltaPhiNearParton->SetYTitle("#Delta #phi");
fhDeltaPhiNearParton->SetXTitle("p_{T particle} (GeV/c)");
outputContainer->Add(fhDeltaPhiNearParton);
fhDeltaEtaNearParton = new TH2F
("DeltaEtaNearParton","#eta_{particle} - #eta_{parton} vs p_{T particle}",
200,0,120,200,-2,2);
fhDeltaEtaNearParton->SetYTitle("#Delta #eta");
fhDeltaEtaNearParton->SetXTitle("p_{T particle} (GeV/c)");
outputContainer->Add(fhDeltaEtaNearParton);
fhDeltaPtNearParton = new TH2F
("DeltaPtNearParton","#p_{T particle} - #p_{T parton} vs p_{T particle}",
200,0,120,100,-10,10);
fhDeltaPtNearParton->SetYTitle("#Delta #p_{T}");
fhDeltaPtNearParton->SetXTitle("p_{T particle} (GeV/c)");
outputContainer->Add(fhDeltaPtNearParton);
fhPtRatNearParton = new TH2F
("PtRatNearParton","#p_{T parton} / #p_{T particle} vs p_{T particle}",
200,0,120,200,0,5);
fhPtRatNearParton->SetYTitle("ratio");
fhPtRatNearParton->SetXTitle("p_{T particle} (GeV/c)");
outputContainer->Add(fhPtRatNearParton);
fhDeltaPhiAwayParton = new TH2F
("DeltaPhiAwayParton","#phi_{particle} - #phi_{parton} vs p_{T particle}",
200,0,120,200,0,6.4);
fhDeltaPhiAwayParton->SetYTitle("#Delta #phi");
fhDeltaPhiAwayParton->SetXTitle("p_{T particle} (GeV/c)");
outputContainer->Add(fhDeltaPhiAwayParton);
fhDeltaEtaAwayParton = new TH2F
("DeltaEtaAwayParton","#eta_{particle} - #eta_{parton} vs p_{T particle}",
200,0,120,200,-2,2);
fhDeltaEtaAwayParton->SetYTitle("#Delta #eta");
fhDeltaEtaAwayParton->SetXTitle("p_{T particle} (GeV/c)");
outputContainer->Add(fhDeltaEtaAwayParton);
fhDeltaPtAwayParton = new TH2F
("DeltaPtAwayParton","#p_{T particle} - #p_{T parton} vs p_{T particle}",
200,0,120,100,-10,10);
fhDeltaPtAwayParton->SetYTitle("#Delta #p_{T}");
fhDeltaPtAwayParton->SetXTitle("p_{T particle} (GeV/c)");
outputContainer->Add(fhDeltaPtAwayParton);
fhPtRatAwayParton = new TH2F
("PtRatAwayParton","#p_{T parton} / #p_{T particle} vs p_{T particle}",
200,0,120,200,0,5);
fhPtRatAwayParton->SetYTitle("ratio");
fhPtRatAwayParton->SetXTitle("p_{T particle} (GeV/c)");
outputContainer->Add(fhPtRatAwayParton);
return outputContainer;
}
//____________________________________________________
// Initialize the parameters of the analysis.
//____________________________________________________
void AliAnaParticlePartonCorrelation::InitParameters()
{
SetInputAODName("CaloTrackParticle");
SetAODObjArrayName("Partons");
AddToHistogramsName("AnaPartonCorr_");
}
//_____________________________________________________________________
// Print some relevant parameters set for the analysis.
//_____________________________________________________________________
void AliAnaParticlePartonCorrelation::Print(const Option_t * opt) const
{
if(! opt)
return;
printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
AliAnaCaloTrackCorrBaseClass::Print(" ");
}
//__________________________________________________________
/// Particle-Parton Correlation Analysis, create AODs.
/// Add partons to the reference list of the trigger particle,
/// Partons are considered those in the first eight possitions in the stack
/// being 0, and 1 the 2 protons, and 6 and 7 the outgoing final partons.
//__________________________________________________________
void AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD()
{
if(!GetInputAODBranch())
AliFatal(Form("No input particles in AOD with name branch < %s > ",GetInputAODName().Data()));
if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliCaloTrackParticleCorrelation"))
AliFatal(Form("Wrong type of AOD object, change AOD class name in input AOD: It should be <AliCaloTrackParticleCorrelation> and not <%s>",
GetInputAODBranch()->GetClass()->GetName()));
AliDebug(1,"Begin fill AODs");
AliDebug(1,Form("In particle branch aod entries %d", GetInputAODBranch()->GetEntriesFast()));
//Loop on stored AOD particles
Int_t naod = GetInputAODBranch()->GetEntriesFast();
for(Int_t iaod = 0; iaod < naod ; iaod++)
{
AliCaloTrackParticleCorrelation* particle = (AliCaloTrackParticleCorrelation*) (GetInputAODBranch()->At(iaod));
if(!GetMC())
{
AliFatal("No Stack available, STOP");
return; // coverity
}
if(GetMC()->GetNumberOfTracks() < 8)
{
AliWarning(Form("*** small number of particles, not a PYTHIA simulation? ***: n tracks %d", GetMC()->GetNumberOfPrimaries()));
continue ;
}
//Fill AOD reference only with partons
//Array with reference to partons, initialize
TObjArray * objarray = NULL;
Int_t nrefs = 0;
AliVParticle * parton = NULL ;
for(Int_t ipr = 0;ipr < 8; ipr ++ )
{
parton = GetMC()->GetTrack(ipr) ;
nrefs++;
if(nrefs==1)
{
objarray = new TObjArray(0);
objarray->SetName(GetAODObjArrayName());
objarray->SetOwner(kFALSE);
}
objarray->Add(parton);
}//parton loop
if(objarray->GetEntriesFast() > 0) particle->AddObjArray(objarray);
}//Aod branch loop
AliDebug(1,"End fill AODs");
}
//_________________________________________________________________
// Particle-Parton Correlation Analysis, fill histograms.
//_________________________________________________________________
void AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
{
if(!GetInputAODBranch())
{
AliFatal(Form("No input particles in AOD with name branch < %s >",GetInputAODName().Data()));
return; //coverity
}
AliDebug(1,"Begin parton correlation analysis, fill histograms");
AliDebug(1,Form("In particle branch aod entries %d", GetInputAODBranch()->GetEntriesFast()));
if(!GetMC())
{
AliFatal("No Stack available, STOP");
return;// coverity
}
// Loop on stored AOD particles
Int_t naod = GetInputAODBranch()->GetEntriesFast();
AliVParticle * mom = NULL ;
for(Int_t iaod = 0; iaod < naod ; iaod++){
AliCaloTrackParticleCorrelation* particle = (AliCaloTrackParticleCorrelation*) (GetInputAODBranch()->At(iaod));
Float_t ptTrigg = particle->Pt();
Float_t phiTrigg = particle->Phi();
Float_t etaTrigg = particle->Eta();
Int_t imom = particle->GetLabel();
Int_t iparent = 2000;
Int_t iawayparent = -1;
TObjArray * objarray = particle->GetObjArray(GetAODObjArrayName());
if(!(objarray) || (objarray->GetEntriesFast() < 7) )
{
AliFatal("Reference list with partons not filled, STOP analysis");
return; // coverity
}
// Check and get indeces of mother and parton
if (imom < 8 )
iparent = imom ; //mother is already a parton
else if (imom < GetMC()->GetNumberOfTracks())
{
mom = GetMC()->GetTrack(imom);
if(mom)
{
iparent=mom->GetMother();
//cout<<" iparent "<<iparent<<endl;
while(iparent > 7 )
{
mom = GetMC()->GetTrack(iparent);
if (mom)
{
imom = iparent ; //Mother label is of the inmediate parton daughter
iparent = mom->GetMother();
}
else iparent = -1;
//cout<<" while iparent "<<iparent<<endl;
}
}
}
AliDebug(1,Form("N reference partons %d; labels: mother %d, parent %d", objarray->GetEntriesFast(), imom, iparent));
if(iparent < 0 || iparent > 8)
{
AliWarning(Form("Failed to find appropriate parton, index %d", iparent));
continue ;
}
// Near parton is the parton that fragmented and created the mother
AliVParticle * nearParton = (AliVParticle*) objarray->At(iparent);
Float_t ptNearParton = nearParton->Pt();
Float_t phiNearParton = nearParton->Phi() ;
Float_t etaNearParton = nearParton->Eta() ;
fhDeltaEtaNearParton->Fill(ptTrigg, etaTrigg-etaNearParton, GetEventWeight());
fhDeltaPhiNearParton->Fill(ptTrigg, phiTrigg-phiNearParton, GetEventWeight());
fhDeltaPtNearParton ->Fill(ptTrigg, ptTrigg-ptNearParton , GetEventWeight());
fhPtRatNearParton ->Fill(ptTrigg, ptNearParton/ptTrigg , GetEventWeight());
if (iparent == 7) iawayparent = 6;
else if(iparent == 6) iawayparent = 7;
else
{
AliWarning("Parent parton is not final state, skip");
continue;
}
// Away parton is the other final parton.
AliVParticle * awayParton = (AliVParticle*) objarray->At(iawayparent);
Float_t ptAwayParton = awayParton->Pt();
Float_t phiAwayParton = awayParton->Phi() ;
Float_t etaAwayParton = awayParton->Eta() ;
fhDeltaEtaAwayParton->Fill(ptTrigg, etaTrigg-etaAwayParton, GetEventWeight());
fhDeltaPhiAwayParton->Fill(ptTrigg, phiTrigg-phiAwayParton, GetEventWeight());
fhDeltaPtAwayParton ->Fill(ptTrigg, ptTrigg-ptAwayParton , GetEventWeight());
fhPtRatAwayParton ->Fill(ptTrigg, ptAwayParton/ptTrigg , GetEventWeight());
}
AliDebug(1,"End fill histograms");
}
|
wix/openrest4j | openrest4j-api/src/main/java/com/openrest/olo/charges/operators/MultiplyOperator.java | package com.openrest.olo.charges.operators;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* Multiplies two lists of values and returns the (integer) division of the results.
* @see <a href="http://en.wikipedia.org/wiki/Empty_product">Empty Product</a>
* @see <a href="https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero">Commercial rounding</a>
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class MultiplyOperator extends Operator {
public static final String TYPE = "multiply";
private static final long serialVersionUID = 1L;
/** Default constructor for JSON deserialization. */
public MultiplyOperator() {}
public MultiplyOperator(List<Operator> numerators, List<Operator> denominators, Map<String, String> properties) {
super(properties);
this.numerators = numerators;
this.denominators = denominators;
}
@Override
public Object clone() {
return new MultiplyOperator(Operator.clone(numerators), Operator.clone(denominators),
((properties != null) ? new LinkedHashMap<>(properties) : null));
}
@JsonInclude(Include.NON_DEFAULT)
public List<Operator> numerators = new LinkedList<>();
@JsonInclude(Include.NON_DEFAULT)
public List<Operator> denominators = new LinkedList<>();
} |
yoriyuki-aist/ccfinderx | GemX/gemx/ClonesetTable.java | package gemx;
import java.text.DecimalFormat;
import java.util.*;
import gnu.trove.*;
import model.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.*;
import customwidgets.SearchboxData;
import customwidgets.SearchboxListener;
import res.Messages;
import resources.MetricColors;
import utility.StringUtil;
public class ClonesetTable implements CloneSelectionListener {
private Table table;
private TableWithCheckHelper tableWithCheckHelper;
private MainWindow mainWindow;
private Shell shell;
private TableColumn[] cols;
private int maxCloneSetCount = 500000;
private int indexAndMore;
private long andMoreCloneSetCount;
private CloneSet[] cloneSets = null;
private DecimalFormat[] fieldFormats;
private ClonesetMetricModel cloneSetMetricModel = null;
public Control getControl() {
return table;
}
public void addListener(int eventType, Listener listener) {
assert eventType == SWT.FocusIn;
this.table.addListener(eventType, listener);
}
public TableWithCheckHelper getTableWithCheckHelper() {
return tableWithCheckHelper;
}
private long[] getSelectedCloneSetIDs() {
int[] selectedIndex = table.getSelectionIndices();
if (selectedIndex.length == 0) {
return new long[] {};
}
int size = selectedIndex.length;
if (Arrays.binarySearch(selectedIndex, indexAndMore) >= 0) {
--size;
}
assert size >= 0;
long[] ids = new long[size];
int p = 0;
for (int i = 0; i < selectedIndex.length; ++i) {
int index = selectedIndex[i];
if (index != indexAndMore) {
long id = cloneSets[index].id;
ids[p] = id;
++p;
}
}
return ids;
}
private String selectedItemsToString() {
int[] selectedIndex = table.getSelectionIndices();
StringBuffer buffer = new StringBuffer();
if (cloneSetMetricModel != null) {
TableColumn[] columns = table.getColumns();
for (int j = 0; j < columns.length - 1; ++j) {
buffer.append(columns[j].getText());
buffer.append('\t');
}
buffer.append(columns[columns.length - 1].getText());
buffer.append(StringUtil.NewLineString);
for (int i = 0; i < selectedIndex.length; ++i) {
int index = selectedIndex[i];
long cloneSetID = cloneSets[index].id;
double[] cm = cloneSetMetricModel.getMetricDataOfCloneSet(cloneSetID);
TableItem item = table.getItem(index);
for (int j = 0; j < columns.length; ++j) {
if (j >= 1) {
int metricIndex = j - 1;
String text = fieldFormats[metricIndex].format(cm[metricIndex]);
buffer.append(text);
} else {
buffer.append(item.getText(j));
}
if (j < columns.length - 1) {
buffer.append('\t');
}
}
buffer.append(StringUtil.NewLineString);
}
} else {
TableColumn[] columns = table.getColumns();
for (int j = 0; j < 2 - 1; ++j) {
buffer.append(columns[j].getText());
buffer.append('\t');
}
buffer.append(columns[2 - 1].getText());
buffer.append(StringUtil.NewLineString);
for (int i = 0; i < selectedIndex.length; ++i) {
int index = selectedIndex[i];
buffer.append(String.valueOf(cloneSets[index].id));
buffer.append('\t');
buffer.append(String.valueOf(cloneSets[index].length));
buffer.append(StringUtil.NewLineString);
}
}
return buffer.toString();
}
private String selectedCloneSetIDsToString() {
int[] selectedIndex = table.getSelectionIndices();
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < selectedIndex.length; ++i) {
int index = selectedIndex[i];
TableItem item = table.getItem(index);
buffer.append(item.getText(0));
buffer.append(StringUtil.NewLineString);
}
return buffer.toString();
}
private void drawCell(GC gc, int x, int y, int cellWidth, int cellHeight, String text) {
Point size = gc.textExtent(text);
int yoffset = Math.max(0, (cellHeight - size.y) / 2);
int xoffset = Math.max(0, cellWidth - size.x - 4);
gc.drawText(text, x + xoffset, y + yoffset, true);
}
private void drawCell(GC gc, int x, int y, int cellWidth, int cellHeight,
double rvalue, String text) {
Color foreground = gc.getForeground();
Color background = gc.getBackground();
int width = (int)((cellWidth - 3) * rvalue) + 2;
Color color = MetricColors.getColor(rvalue);
gc.setBackground(color);
gc.setForeground(MetricColors.getFrameColor());
int height = (int)((cellHeight - 3) * 0.4 + 2);
int cornerR = (int)(height * 0.8);
gc.setAdvanced(true);
if (cornerR >= 2 && gc.getAdvanced()) {
gc.setAntialias(SWT.ON);
gc.fillRoundRectangle(x, y + cellHeight - height - 1, width, height, cornerR, cornerR);
gc.drawRoundRectangle(x, y + cellHeight - height - 1, width, height, cornerR, cornerR);
gc.setAntialias(SWT.OFF);
} else {
gc.fillRectangle(x, y + cellHeight - height - 1, width, height);
gc.drawRectangle(x, y + cellHeight - height - 1, width, height);
}
Point size = gc.textExtent(text);
int yoffset = Math.max(0, (cellHeight - size.y) / 2);
int xoffset = Math.max(0, cellWidth - size.x - 4);
gc.setForeground(foreground);
gc.drawText(text, x + xoffset, y + yoffset, true);
gc.setBackground(background);
}
private static class CloneSetMetricComparator implements Comparator<CloneSet> {
private final ClonesetMetricModel cloneSetMetricModel;
private final int metricIndex;
private final int dir;
public CloneSetMetricComparator(ClonesetMetricModel cloneSetMetricModel, int metricIndex, int dir) {
this.cloneSetMetricModel = cloneSetMetricModel;
this.metricIndex = metricIndex;
this.dir = dir;
}
public int compare(CloneSet cs0, CloneSet cs1) {
long id0 = cs0.id;
long id1 = cs1.id;
double metric0 = cloneSetMetricModel.getNthMetricDataOfCloneSet(id0, metricIndex);
double metric1 = cloneSetMetricModel.getNthMetricDataOfCloneSet(id1, metricIndex);
if (dir == -1) {
return metric0 <= metric1 ? -1 : 1;
}
else {
return metric0 <= metric1 ? 1 : -1;
}
}
}
private void sortCloneIDsByMetric(CloneSet cloneSets[], int start, int end,
ClonesetMetricModel cloneSetMetricModel, int metricIndex,
int order /* -1 up, 1 down */)
{
Arrays.sort(cloneSets, start, end, new CloneSetMetricComparator(cloneSetMetricModel, metricIndex, order));
}
private void sortCloneIDsByLength(CloneSet cloneSets[], int start, int end,
int order /* -1 up, 1 down */)
{
if (order == -1) {
Arrays.sort(cloneSets, start, end, new Comparator<CloneSet>() {
public int compare(CloneSet cs0, CloneSet cs1) {
return cs0.length <= cs1.length ? -1 : 1;
}
});
} else {
Arrays.sort(cloneSets, start, end, new Comparator<CloneSet>() {
public int compare(CloneSet cs0, CloneSet cs1) {
return cs0.length <= cs1.length ? 1 : -1;
}
});
}
}
private void sortCloneIDsByID(CloneSet cloneSets[], int start, int end,
int order /* -1 up, 1 down */)
{
if (order == -1) {
Arrays.sort(cloneSets, start, end, new Comparator<CloneSet>() {
public int compare(CloneSet cs0, CloneSet cs1) {
return cs0.id <= cs1.id ? -1 : 1;
}
});
} else {
Arrays.sort(cloneSets, start, end, new Comparator<CloneSet>() {
public int compare(CloneSet cs0, CloneSet cs1) {
return cs0.id <= cs1.id ? 1 : -1;
}
});
}
}
public void copyItemsToClipboard() {
Clipboard clipboard = mainWindow.clipboard;
clipboard.setContents(new Object[]{ selectedItemsToString() },
new Transfer[]{ TextTransfer.getInstance() });
}
public void selectAllItems() {
table.selectAll();
}
public void addCheckMarksToSelectedItems() {
int[] selectedIndices = table.getSelectionIndices();
Arrays.sort(selectedIndices);
for (int i = 0; i < selectedIndices.length; ++i) {
TableItem item = table.getItem(selectedIndices[i]);
item.setChecked(true);
}
}
public void removeCheckMarksFromSelectedItems() {
int[] selectedIndices = table.getSelectionIndices();
Arrays.sort(selectedIndices);
for (int i = 0; i < selectedIndices.length; ++i) {
TableItem item = table.getItem(selectedIndices[i]);
item.setChecked(false);
}
}
public void invertCheckMarks() {
final int itemCount = table.getItemCount();
for (int i = 0; i < itemCount; ++i) {
TableItem item = table.getItem(i);
boolean checked = item.getChecked();
item.setChecked(! checked);
}
}
public long[] getCheckedCloneSetIDs() {
TLongArrayList checked = new TLongArrayList();
final int itemCount = table.getItemCount();
for (int i = 0; i < itemCount; ++i) {
TableItem item = table.getItem(i);
if (item.getChecked()) {
long id = cloneSets[i].id;
checked.add(id);
}
}
return checked.toNativeArray();
}
private void buildMenuToTable(boolean bAddResetScopeItemToContextMenu) {
Menu pmenu = new Menu(shell, SWT.POP_UP);
table.setMenu(pmenu);
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_COPY_ITEMS")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
copyItemsToClipboard();
}
});
}
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_COPY_CLONE_SET_IDS")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Clipboard clipboard = mainWindow.clipboard;
clipboard.setContents(new Object[]{ selectedCloneSetIDsToString() },
new Transfer[]{ TextTransfer.getInstance() });
}
});
}
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_PASTE_SELECTION")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
long[] cloneSetIDs = new long[ClonesetTable.this.cloneSets.length];
for (int i = 0; i < cloneSetIDs.length; ++i) {
cloneSetIDs[i] = ClonesetTable.this.cloneSets[i].id;
}
Arrays.sort(cloneSetIDs);
Clipboard cb = mainWindow.clipboard;
TextTransfer textTransfer = TextTransfer.getInstance();
String str = (String)cb.getContents(textTransfer);
if (str == null) {
return;
}
if (str.length() > 0 && str.charAt(0) == '#') {
searchingId(str);
return;
}
long[] selected = null;
try {
String[] lines = str.split(StringUtil.NewLineString);
long[] selections = new long[lines.length];
int count = 0;
for (int i = 0; i < lines.length; ++i) {
try {
String line = lines[i];
int tabpos = line.indexOf('\t');
if (tabpos >= 0) {
line = line.substring(0, tabpos);
}
long cloneSetID = Long.parseLong(line);
if (Arrays.binarySearch(cloneSetIDs, cloneSetID) >= 0) {
selections[count] = cloneSetID;
++count;
}
} catch (NumberFormatException ex) {
// nothing to do
}
}
selected = utility.ArrayUtil.slice(selections, 0, count);
} finally {
if (selected != null) {
ClonesetTable.this.mainWindow.setCloneSelection(selected, null);
} else {
ClonesetTable.this.mainWindow.setCloneSelection(new long[] { }, null);
}
}
}
});
}
new MenuItem(pmenu, SWT.SEPARATOR);
{
MenuItem pitemCheck = new MenuItem(pmenu, SWT.CASCADE);
pitemCheck.setText(Messages.getString("gemx.ClonesetTable.M_CHECK_MARK")); //$NON-NLS-1$
Menu pmenuCheck = new Menu(pitemCheck);
pitemCheck.setMenu(pmenuCheck);
tableWithCheckHelper.addCheckRelatedItemsToMenu(pmenuCheck);
}
new MenuItem(pmenu, SWT.SEPARATOR);
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_FIT_SCOPE_TO_SELECTED_CLONE_SETS")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
long[] selectedIDs = getSelectedCloneSetIDs();
ClonesetTable.this.mainWindow.fitScopeToCloneSetIDs(selectedIDs);
}
});
}
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_POP_SCOPE")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ClonesetTable.this.mainWindow.popScope();
}
});
}
// if (bAddResetScopeItemToContextMenu) {
// MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
// pitem.setText("&Reset Scope");
// pitem.setSelection(true);
// pitem.addSelectionListener(new SelectionAdapter() {
// public void widgetSelected(SelectionEvent e) {
// ClonesetTable.this.mainWindow.resetScope();
// }
// });
// }
new MenuItem(pmenu, SWT.SEPARATOR);
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_SELECT_FILES_INCLUDING_THEM")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
long[] selectedIDs = getSelectedCloneSetIDs();
ClonesetTable.this.mainWindow.selectFilesByCloneClassID(selectedIDs);
ClonesetTable.this.mainWindow.showFileTable();
}
});
}
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_SELECT_FILES_INCLUDING_ALL_OF_THEM")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
long[] selectedIDs = getSelectedCloneSetIDs();
ClonesetTable.this.mainWindow.selectCommonFilesByCloneClassID(selectedIDs);
ClonesetTable.this.mainWindow.showFileTable();
}
});
}
new MenuItem(pmenu, SWT.SEPARATOR);
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_ADD_CLONE_SET_METRICS")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ClonesetTable.this.mainWindow.addCloneSetMetrics();
}
});
}
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_FILTER_CLONE_SET_BY_METRIC")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ClonesetTable.this.mainWindow.doFilteringCloneSetByMetrics();
}
});
}
new MenuItem(pmenu, SWT.SEPARATOR);
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.ClonesetTable.M_SHOW_A_CODE_FRAGMENT")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
long[] selectedIDs = getSelectedCloneSetIDs();
if (selectedIDs.length == 1) {
if (! ClonesetTable.this.mainWindow.isTextPaneShown()) {
ClonesetTable.this.mainWindow.showTextPane();
}
ClonesetTable.this.mainWindow.showACodeFragmentOfClone(selectedIDs[0], ClonesetTable.this);
}
else {
MessageBox mes = new MessageBox(shell, SWT.OK | SWT.ICON_WARNING);
mes.setText("Warning - GemX"); //$NON-NLS-1$
mes.setMessage(Messages.getString("gemx.CloneSetTable.S_SELECT_ONE_CLONE_SET")); //$NON-NLS-1$
mes.open();
return;
}
}
});
}
new MenuItem(pmenu, SWT.SEPARATOR);
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_SHOW_NEXT_CODE")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
long[] selectedIDs = getSelectedCloneSetIDs();
if (selectedIDs.length == 1) {
if (! ClonesetTable.this.mainWindow.isTextPaneShown()) {
ClonesetTable.this.mainWindow.showTextPane();
}
ClonesetTable.this.mainWindow.showNextPairedCodeOfClone(selectedIDs[0], 1, ClonesetTable.this);
}
else {
MessageBox mes = new MessageBox(shell, SWT.OK | SWT.ICON_WARNING);
mes.setText("Warning - GemX"); //$NON-NLS-1$
mes.setMessage(Messages.getString("gemx.CloneSetTable.S_SELECT_ONE_CLONE_SET")); //$NON-NLS-1$
mes.open();
return;
}
}
});
}
{
MenuItem pitem = new MenuItem(pmenu, SWT.PUSH);
pitem.setText(Messages.getString("gemx.CloneSetTable.M_SHOW_PREV_CODE")); //$NON-NLS-1$
pitem.setSelection(true);
pitem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
long[] selectedIDs = getSelectedCloneSetIDs();
if (selectedIDs.length == 1) {
if (! ClonesetTable.this.mainWindow.isTextPaneShown()) {
ClonesetTable.this.mainWindow.showTextPane();
}
ClonesetTable.this.mainWindow.showNextPairedCodeOfClone(selectedIDs[0], -1, ClonesetTable.this);
}
else {
MessageBox mes = new MessageBox(shell, SWT.OK | SWT.ICON_WARNING);
mes.setText("Warning - GemX"); //$NON-NLS-1$
mes.setMessage(Messages.getString("gemx.CloneSetTable.S_SELECT_ONE_CLONE_SET")); //$NON-NLS-1$
mes.open();
return;
}
}
});
}
}
public ClonesetTable(Composite parent, boolean bAddResetScopeItemToContextMenu, MainWindow mainWindow) {
this.mainWindow = mainWindow;
shell = parent.getShell();
table = new Table(parent, SWT.VIRTUAL | SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK);
tableWithCheckHelper = new TableWithCheckHelper(table) {
@Override
public void selectCheckedItems() {
super.selectCheckedItems();
long[] selectedIDs = getSelectedCloneSetIDs();
if (selectedIDs.length == 1 && ClonesetTable.this.mainWindow.isTextPaneShown()) {
ClonesetTable.this.mainWindow.showACodeFragmentOfClone(selectedIDs[0], ClonesetTable.this);
} else {
ClonesetTable.this.mainWindow.setCloneSelection(selectedIDs, ClonesetTable.this);
}
}
};
table.setHeaderVisible(true);
String[] colCaps = { "Clone-Set ID", "LEN", "", "", "", "", "", "", "", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
int[] colWids = { 30, 50, 5, 5, 5, 5, 5, 5, 5, 5 };
cols = new TableColumn[colCaps.length];
for (int i = 0; i < colCaps.length; ++i) {
TableColumn col = new TableColumn(table, SWT.RIGHT);
cols[i] = col;
col.setText(colCaps[i]);
col.setWidth(colWids[i]);
}
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
long[] selectedIDs = getSelectedCloneSetIDs();
if (selectedIDs.length == 1 && ClonesetTable.this.mainWindow.isTextPaneShown()) {
if (ClonesetTable.this.mainWindow.getMain().settingClonesetTableClickToShowPair) {
int direction = (e.stateMask & SWT.SHIFT) != 0 ? 1 : -1;
ClonesetTable.this.mainWindow.showNextPairedCodeOfClone(selectedIDs[0], direction, ClonesetTable.this);
} else {
ClonesetTable.this.mainWindow.showACodeFragmentOfClone(selectedIDs[0], ClonesetTable.this);
}
} else {
ClonesetTable.this.mainWindow.setCloneSelection(selectedIDs, ClonesetTable.this);
}
}
});
table.addListener(SWT.PaintItem, new Listener() {
public void handleEvent(Event event) {
TableItem item = (TableItem)event.item;
int i = table.indexOf(item);
int colWidth = cols[event.index].getWidth();
if (event.index == 0) {
// do nothing
} else if (event.index == 1) {
if (cloneSets != null) {
if (i != indexAndMore) {
if (cloneSetMetricModel != null) {
long cloneSetID = cloneSets[i].id;
int metricIndex = event.index - 1; // magic number
double cm = cloneSetMetricModel.getNthMetricDataOfCloneSet(cloneSetID, metricIndex);
double rcm = cloneSetMetricModel.getNthRelativeMetricDataOfCloneSet(cloneSetID, metricIndex);
String text = fieldFormats[metricIndex].format(cm);
drawCell(event.gc, event.x, event.y, colWidth, event.height, rcm, text);
} else {
String str = String.valueOf(cloneSets[i].length);
drawCell(event.gc, event.x, event.y, colWidth, event.height, str);
}
}
}
} else {
if (cloneSets != null) {
if (i != indexAndMore) {
if (cloneSetMetricModel != null) {
long cloneSetID = cloneSets[i].id;
int metricIndex = event.index - 1; // magic number
double cm = cloneSetMetricModel.getNthMetricDataOfCloneSet(cloneSetID, metricIndex);
double rcm = cloneSetMetricModel.getNthRelativeMetricDataOfCloneSet(cloneSetID, metricIndex);
String text = fieldFormats[metricIndex].format(cm);
drawCell(event.gc, event.x, event.y, colWidth, event.height, rcm, text);
}
}
}
}
}
});
{
Listener sortListener = new Listener() {
public void handleEvent(Event e) {
// determine new sort column and direction
TableColumn sortColumn = table.getSortColumn();
TableColumn currentColumn = (TableColumn) e.widget;
int dir = table.getSortDirection();
if (sortColumn == currentColumn) {
dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
} else {
table.setSortColumn(currentColumn);
dir = SWT.UP;
}
// sort the data based on column and direction
int index = -1;
for (int i = 0; i < cols.length; ++i) {
if (currentColumn == cols[i]) {
index = i;
}
}
int endIndex = ClonesetTable.this.indexAndMore != -1 ? ClonesetTable.this.indexAndMore : cloneSets.length;
if (cloneSets != null && index == 0) {
sortCloneIDsByID(cloneSets, 0, endIndex, dir == SWT.UP ? -1 : 1);
} else if (cloneSets != null && cloneSetMetricModel != null) {
int metricIndex = index - 1; // magic number
sortCloneIDsByMetric(cloneSets, 0, endIndex, cloneSetMetricModel, metricIndex, dir == SWT.UP ? -1 : 1);
} else if (cloneSets != null && index == 1) {
sortCloneIDsByLength(cloneSets, 0, endIndex, dir == SWT.UP ? -1 : 1);
}
// update data displayed in table
table.setSortDirection(dir);
table.clearAll();
updateCloneSetIDCells();
}
};
for (int i = 0; i < cols.length; ++i) {
cols[i].addListener(SWT.Selection, sortListener);
}
}
table.setSortColumn(cols[0]);
table.setSortDirection(SWT.UP);
buildMenuToTable(bAddResetScopeItemToContextMenu);
}
private void updateCloneSetIDCells() {
for (int i = 0; i < this.cloneSets.length; ++i) {
TableItem item = table.getItem(i);
if (i == indexAndMore) {
item.setText(0, "+" + String.valueOf(andMoreCloneSetCount) + " clone sets"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
CloneSet cs = cloneSets[i];
item.setText(0, String.valueOf(cs.id));
}
}
}
public boolean isCloneSetSizeTooLarge() {
return indexAndMore != -1;
}
public void updateModel(Model data) {
cloneSetMetricModel = null;
boolean tableVisible = table.isVisible();
if (tableVisible) {
table.setVisible(false);
}
try {
table.setSortColumn(cols[0]);
table.setSortDirection(SWT.UP);
final int ccount = table.getColumnCount();
for (int i = 2; i < ccount; ++i) {
TableColumn tci = table.getColumn(i);
tci.setText(""); //$NON-NLS-1$
}
table.removeAll();
CloneSet[] cloneSets = data.getCloneSets(maxCloneSetCount);
this.andMoreCloneSetCount = data.getCloneSetCount() - cloneSets.length;
int size = cloneSets.length;
indexAndMore = -1;
if (cloneSets.length >= 1 && cloneSets[cloneSets.length - 1].id == -1) {
indexAndMore = cloneSets.length - 1;
--size;
}
assert size >= 0;
for (int i = 0; i < cloneSets.length; ++i) {
new TableItem(table, SWT.NULL);
}
this.cloneSets = new CloneSet[size];
for (int i = 0; i < this.cloneSets.length; ++i) {
if (i == indexAndMore) {
this.cloneSets[i] = new CloneSet(-1, -1);
} else {
this.cloneSets[i] = cloneSets[i];
}
}
updateCloneSetIDCells();
{
TableColumn[] columns = table.getColumns();
for (int cnt = 0; cnt < columns.length; cnt++) {
columns[cnt].pack();
}
}
} finally {
if (tableVisible) {
table.setVisible(true);
}
}
}
public void setCloneSelection(long[] ids, CloneSelectionListener src) {
if (src == this) {
return;
}
long[] idsc = ids.clone();
Arrays.sort(idsc);
boolean firstOne = true;
table.deselectAll();
int itemCount = table.getItemCount();
for (int i = 0; i < itemCount; ++i) {
if (i != indexAndMore) {
long id = cloneSets[i].id;
if (Arrays.binarySearch(idsc, id) >= 0) {
table.select(i);
if (firstOne) {
table.showItem(table.getItem(i));
}
firstOne = false;
}
}
}
}
public void addCloneSetMetricModel(ClonesetMetricModel cloneSetMetricModel) {
boolean tableVisible = table.isVisible();
if (tableVisible) {
table.setVisible(false);
}
try {
this.cloneSetMetricModel = cloneSetMetricModel;
for (int i = 0; i < cloneSetMetricModel.getFieldCount(); ++i) {
TableColumn tc = table.getColumn(i + 1);
tc.setText(cloneSetMetricModel.getMetricName(i)); //$NON-NLS-1$
}
DecimalFormat intFormat = new DecimalFormat("#"); //$NON-NLS-1$
DecimalFormat doubleFormat = new DecimalFormat("#.000"); //$NON-NLS-1$
fieldFormats = new DecimalFormat[cloneSetMetricModel.getFieldCount()];
for (int i = 0; i < fieldFormats.length; ++i) {
if (cloneSetMetricModel.isFlotingPoint(i)) {
fieldFormats[i] = doubleFormat;
} else {
fieldFormats[i] = intFormat;
}
}
if (cloneSets != null) {
final String nullString = new String();
int count = cloneSets.length;
for (int i = 0; i < count; ++i) {
TableItem item = table.getItem(i);
for (int columnIndex = 1; columnIndex < 9; ++columnIndex) {
//int metricIndex = columnIndex - 2;
item.setText(columnIndex, nullString);
}
}
}
{
TableColumn[] columns = table.getColumns();
for (int cnt = 0; cnt < columns.length; cnt++) {
columns[cnt].pack();
}
}
} finally {
if (tableVisible) {
table.setVisible(true);
}
}
}
public void addCheckmarks(long[] cloneSetIDs) {
long[] ids = cloneSetIDs.clone();
Arrays.sort(ids);
final int count = table.getItemCount();
for (int i = 0; i < count; ++i) {
if (i != indexAndMore) {
long id = cloneSets[i].id;
if (Arrays.binarySearch(ids, id) >= 0) {
TableItem item = table.getItem(i);
item.setChecked(true);
}
}
}
}
private void searchingId(String text) {
assert text.startsWith("#"); //$NON-NLS-1$
if (cloneSets == null) {
return;
}
try {
final String[] fields = utility.StringUtil.split(text.substring(1), ',');
final long[] ids = new long[fields.length];
for (int fi = 0; fi < fields.length; ++fi) {
long id = Long.parseLong(fields[fi]);
ids[fi] = id;
}
Arrays.sort(ids);
final utility.BitArray founds = new utility.BitArray(fields.length);
final int itemCount = table.getItemCount();
int firstFoundIndex = -1;
for (int i = 0; i < itemCount; ++i) {
if (i != indexAndMore) {
for (int fi = 0; fi < fields.length; ++fi) {
if (Arrays.binarySearch(ids, cloneSets[i].id) >= 0) {
founds.setAt(fi, true);
if (firstFoundIndex < 0) {
firstFoundIndex = i;
}
}
}
}
}
TLongArrayList foundIDs = new TLongArrayList();
{
int fi = founds.find(true);
while (fi >= 0) {
foundIDs.add(ids[fi]);
fi = founds.find(true, fi + 1);
}
}
if (foundIDs.size() > 0) {
ClonesetTable.this.mainWindow.setCloneSelection(foundIDs.toNativeArray(), ClonesetTable.this);
assert firstFoundIndex >= 0;
table.setSelection(firstFoundIndex);
}
} catch (NumberFormatException e) {
// error!
}
}
public SearchboxListener getSearchboxListener() {
return new SearchboxListener() {
public void searchBackward(SearchboxData data) {
String text = data.text;
if (text.startsWith("#")) { //$NON-NLS-1$
searchingId(text);
return;
}
}
public void searchCanceled(SearchboxData data) {
}
public void searchForward(SearchboxData data) {
String text = data.text;
if (text.startsWith("#")) { //$NON-NLS-1$
searchingId(text);
return;
}
}
};
}
}
|
tolkonepiu/dsm-webapi-client | dsm-webapi-client-filestation/src/main/java/com/github/gauthierj/dsm/webapi/client/filestation/filelist/FilePermission.java | <reponame>tolkonepiu/dsm-webapi-client
package com.github.gauthierj.dsm.webapi.client.filestation.filelist;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.gauthierj.dsm.webapi.client.filestation.common.Acl;
public class FilePermission {
private final int posix;
private final boolean aclMode;
private final Acl acl;
@JsonCreator
public FilePermission(
@JsonProperty("posix") int posix,
@JsonProperty("is_acl_mode") boolean aclMode,
@JsonProperty("acl") Acl acl) {
this.posix = posix;
this.aclMode = aclMode;
this.acl = acl;
}
public int getPosix() {
return posix;
}
public boolean isAclMode() {
return aclMode;
}
public Acl getAcl() {
return acl;
}
}
|
qiunet/DuoDuo | QiunetUtils/src/test/java/org/qiunet/utils/test/scanner/TestClassScanner.java | package org.qiunet.utils.test.scanner;
import org.junit.Assert;
import org.junit.Test;
import org.qiunet.utils.scanner.ClassScanner;
import org.qiunet.utils.scanner.anno.AutoWired;
/**
* @author qiunet
* Created on 17/1/23 19:57.
*/
public class TestClassScanner {
public static String clazzName;
@AutoWired
private static ITestInterface testInterface;
@AutoWired
private static ITestIgnoreWired wired;
@Test
public void testClassScanner() {
ClassScanner.getInstance()
.addParam(ArgKey.Test, 10)
.scanner();
Assert.assertNotNull(clazzName);
Assert.assertEquals("PlayerHandler", clazzName);
Assert.assertEquals(12345678, testInterface.getType());
}
}
|
VladimirLafazan/TradeItIosTicketSDK2 | TradeItIosEmsApi/TradeItPreviewTradeRequest.h | #import <Foundation/Foundation.h>
#import "TradeItAuthenticatedRequest.h"
@interface TradeItPreviewTradeRequest : TradeItAuthenticatedRequest
@property (nonatomic, copy) NSString *accountNumber;
@property (nonatomic, copy) NSString *orderSymbol;
@property (nonatomic, copy) NSString *orderPriceType;
@property (nonatomic, copy) NSString *orderAction;
@property (nonatomic, copy) NSNumber *orderQuantity;
@property (nonatomic, copy) NSString *orderQuantityType;
@property (nonatomic, copy) NSString *orderExpiration;
@property (nonatomic, copy) NSNumber<Optional> *orderLimitPrice;
@property (nonatomic, copy) NSNumber<Optional> *orderStopPrice;
@property (nonatomic) BOOL userDisabledMargin;
@end
|
DankersW/home-automation-framework | home_automation_framework.py | from home_automation_framework.framework.framework import IotSubject
class HomeServer:
def __init__(self):
# start listing for connected devices
iot_subject = IotSubject()
iot_subject.run()
if __name__ == '__main__':
home_server = HomeServer()
|
hefen1/chromium | chrome/browser/chromeos/ui_proxy_config_service.h | <reponame>hefen1/chromium<filename>chrome/browser/chromeos/ui_proxy_config_service.h
// Copyright 2013 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 CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_
#define CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_
#include <string>
#include "base/basictypes.h"
#include "chrome/browser/chromeos/ui_proxy_config.h"
class PrefService;
namespace chromeos {
class NetworkState;
// This class is only accessed from the UI via Profile::GetProxyConfigTracker to
// allow the user to read and modify the proxy configuration via
// GetProxyConfig and SetProxyConfig.
//
// Before reading/setting a proxy config, a network has to be selected using
// either SetCurrentNetwork (any remembered network) or
// MakeActiveNetworkCurrent.
class UIProxyConfigService {
public:
UIProxyConfigService();
~UIProxyConfigService();
// After this call, proxy settings are read from |profile_prefs| and
// |local_state_prefs|. In case of usage for the sign-in screen,
// |profile_prefs| must be NULL because sign-in screen should depend only on
// shared settings.
void SetPrefs(PrefService* profile_prefs, PrefService* local_state_prefs);
// Called by UI to set the network with service path |current_network| to be
// displayed or edited. Subsequent Set*/Get* methods will use this
// network, until this method is called again.
void SetCurrentNetwork(const std::string& current_network);
void UpdateFromPrefs();
// Called from UI to retrieve the stored proxy configuration, which is either
// the last proxy config of the current network or the one last set by
// SetProxyConfig.
void GetProxyConfig(UIProxyConfig* config) const;
// Called from UI to update proxy configuration for different modes. Stores
// and persists |config| to shill for the current network.
void SetProxyConfig(const UIProxyConfig& config);
private:
// Determines effective proxy config based on prefs from config tracker,
// |network| and if user is using shared proxies. The effective config is
// stored in |current_ui_config_| but not activated on network stack, and
// hence, not picked up by observers.
void DetermineEffectiveConfig(const NetworkState& network);
// Service path of network whose proxy configuration is being displayed or
// edited via UI.
std::string current_ui_network_;
// Proxy configuration of |current_ui_network_|.
UIProxyConfig current_ui_config_;
// Not owned.
PrefService* profile_prefs_;
// Not owned.
PrefService* local_state_prefs_;
DISALLOW_COPY_AND_ASSIGN(UIProxyConfigService);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_
|
wjiec/leetcode-solution | leetcode-java/src/lcci/s4/p4checkbalancelcci/Solution.java | package lcci.s4.p4checkbalancelcci;
import common.TreeNode;
/**
* 面试题 04.04. 检查平衡性
*
* https://leetcode-cn.com/problems/check-balance-lcci/
*
* 实现一个函数,检查二叉树是否平衡。在这个问题中,平衡树的定义如下:
*
* 任意一个节点,其两棵子树的高度差不超过 1。
*/
public class Solution {
public boolean isBalanced(TreeNode root) {
if (root == null) return true;
return isBalanced(root.left) && isBalanced(root.right) && Math.abs(height(root.left) - height(root.right)) <= 1;
}
private int height(TreeNode node) {
if (node == null) return 0;
int left = height(node.left);
int right = height(node.right);
return Math.max(left, right) + 1;
}
public static void main(String[] args) {
assert new Solution().isBalanced(TreeNode.build(3,9,20,null,null,15,7));
assert !new Solution().isBalanced(TreeNode.build(1,2,2,3,3,null,null,4,4));
}
}
|
teug91/amr | apps/isolate-rc/src/components/BatchTable/index.js | export { BatchTable } from './BatchTable'
|
13462652275/react-laboratory | src/utils/prototype.js | // 插值搜索( 该方法在已排序的数组性能好,非已排序的请用 findIndex )
Array.prototype.insertionSearch = function (item) {
let _this = this, low = 0, high = this.length - 1, mid, element, attribute;
const arrayItem = function (index) {
return attribute ? _this[index][attribute] : _this[index];
};
if (typeof item === 'object') {
for (let key in item) {
attribute = key;
item = item[key];
break;
}
}
while (low <= high) {
mid = Math.floor(low + (item - arrayItem(low)) / (arrayItem(high) - arrayItem(low)) * (high - low));
element = arrayItem(mid);
if (element < item) {
low = mid + 1;
} else if (element > item) {
high = mid - 1;
} else {
return mid;
}
}
return -1;
};
// 日期格式化
Date.prototype.format = function (fmt) {
const date = {
'M+': this.getMonth() + 1, // 月
'd+': this.getDate(), // 日
'h+': this.getHours(), // 时
'm+': this.getMinutes(), // 分
's+': this.getSeconds(), // 秒
'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
'S': this.getMilliseconds() // 毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
for (let key in date) {
if (new RegExp('(' + key + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (date[key]) : (('00' + date[key]).substr(('' + date[key]).length)));
}
}
return fmt;
};
console.area = function () {
console.log('\n');
console.log('-- start --');
console.info.apply(undefined, arguments);
console.log('-- end --');
console.log('\n');
}; |
Mattlk13/Minigames | Minigames/src/main/java/au/com/mineauz/minigames/sounds/PlayMGSound.java | <reponame>Mattlk13/Minigames
package au.com.mineauz.minigames.sounds;
import au.com.mineauz.minigames.objects.MinigamePlayer;
import au.com.mineauz.minigames.Minigames;
import au.com.mineauz.minigames.minigame.Minigame;
import au.com.mineauz.minigames.minigame.Team;
import org.bukkit.Bukkit;
public class PlayMGSound {
private static boolean shouldPlay = Minigames.getPlugin().getConfig().getBoolean("playSounds");
public static void playSound(MinigamePlayer player, MGSound sound) {
if (!shouldPlay) return;
if (sound.getCount() == 1)
player.getPlayer().playSound(player.getLocation(), sound.getSound(), sound.getVolume(), sound.getPitch());
else {
playLoop(player, sound.clone());
}
}
private static void playLoop(MinigamePlayer player, MGSound sound) {
final MinigamePlayer fplayer = player;
final MGSound fsound = sound;
Bukkit.getScheduler().scheduleSyncDelayedTask(Minigames.getPlugin(), () -> {
fplayer.getPlayer().playSound(fplayer.getLocation(), fsound.getSound(), fsound.getVolume(), fsound.getPitch());
fsound.setTimesPlayed(fsound.getTimesPlayed() + 1);
if (fsound.getTimesPlayed() < fsound.getCount())
playLoop(fplayer, fsound);
}, sound.getDelay());
}
public static void playSound(Minigame minigame, MGSound sound) {
for (MinigamePlayer player : minigame.getPlayers())
playSound(player, sound);
}
public static void playSound(Team team, MGSound sound) {
for (MinigamePlayer player : team.getPlayers())
playSound(player, sound);
}
}
|
1804Apr23Java/TruongR | workspace-sts-3.9.4.RELEASE/JDBCBank/src/main/java/com/revature/domain/Admin.java | <filename>workspace-sts-3.9.4.RELEASE/JDBCBank/src/main/java/com/revature/domain/Admin.java
package com.revature.domain;
public class Admin {
}
|
Meanwhale/MeanscriptCLI | src/MeanscriptCpp/pub/MSWriter.h | <filename>src/MeanscriptCpp/pub/MSWriter.h
namespace meanscript {
class MSWriter
{
public:
MSBuilder* builder;
meanscriptcore::StructDef* sd;
int32_t baseAddress;
MSWriter(MSBuilder* _builder, meanscriptcore::StructDef* _sd, int32_t _address);
void setInt (std::string name, int32_t value);
void setInt64 (std::string name, int64_t value);
void setFloat (std::string name, float value);
void setFloat64 (std::string name, double value);
void setBool (std::string name, bool value);
void setText (std::string name, std::string value);
void setChars (std::string name, std::string value);
private: // hide
MSWriter() = delete;
MSWriter & operator = (MSWriter &) = delete;
MSWriter & operator & () = delete;
MSWriter * operator * () = delete;
};
} // namespace meanscript(core)
|
tripsimian/react-kiwicom-margarita | packages/universal-components/src/FilterButton/__tests__/index.test.js | <reponame>tripsimian/react-kiwicom-margarita
// @flow
import * as React from 'react';
import { render, fireEvent } from 'react-native-testing-library';
import snapshotDiff from 'snapshot-diff';
import { FilterButton } from '..';
import { Icon } from '../../Icon';
describe('FilterButton', () => {
const onPress = jest.fn();
const title = 'Title';
const icon = <Icon name="close" />;
const { getByText } = render(
<FilterButton isActive={false} title={title} onPress={onPress} />,
);
const button = getByText('Title');
it('should contain a title', () => {
expect(button).toBeDefined();
});
it('should execute onPress function', () => {
fireEvent.press(button);
});
it('should contain an icon', () => {
const { getByType } = render(
<FilterButton
isActive={false}
title={title}
onPress={onPress}
icon={icon}
/>,
);
const filterIcon = getByType(Icon);
expect(filterIcon).toBeDefined();
});
it('should match snapshot diff between active and inactive input', () => {
const active = <FilterButton isActive title={title} onPress={onPress} />;
const inactive = (
<FilterButton isActive={false} title={title} onPress={onPress} />
);
expect(
snapshotDiff(active, inactive, { contextLines: 1 }),
).toMatchSnapshot();
});
});
|
josephhyatt/learn_co | activerecord-costume-store-todo-v-000/db/schema.rb | <filename>activerecord-costume-store-todo-v-000/db/schema.rb
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 3) do
create_table "costume_stores", force: :cascade do |t|
t.string "name"
t.string "location"
t.integer "costume_inventory"
t.integer "num_of_employees"
t.boolean "still_in_business"
t.datetime "opening_time"
t.datetime "closing_time"
end
create_table "costumes", force: :cascade do |t|
t.string "name"
t.float "price"
t.string "image_url"
t.string "size"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "haunted_houses", force: :cascade do |t|
t.string "name"
t.string "location"
t.string "theme"
t.float "price"
t.boolean "family_friendly"
t.datetime "opening_date"
t.datetime "closing_date"
t.text "description"
end
end
|
aiguoxin/axon-framework-study | axon-server-connector/target/generated-sources/protobuf/java/io/axoniq/axonserver/grpc/event/EventWithTokenOrBuilder.java | <reponame>aiguoxin/axon-framework-study<gh_stars>0
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: event.proto
package io.axoniq.axonserver.grpc.event;
public interface EventWithTokenOrBuilder extends
// @@protoc_insertion_point(interface_extends:io.axoniq.axonserver.grpc.event.EventWithToken)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* The Token representing the position of this Event in the Stream
* </pre>
*
* <code>int64 token = 1;</code>
*/
long getToken();
/**
* <pre>
* The actual Event Message
* </pre>
*
* <code>.io.axoniq.axonserver.grpc.event.Event event = 2;</code>
*/
boolean hasEvent();
/**
* <pre>
* The actual Event Message
* </pre>
*
* <code>.io.axoniq.axonserver.grpc.event.Event event = 2;</code>
*/
io.axoniq.axonserver.grpc.event.Event getEvent();
/**
* <pre>
* The actual Event Message
* </pre>
*
* <code>.io.axoniq.axonserver.grpc.event.Event event = 2;</code>
*/
io.axoniq.axonserver.grpc.event.EventOrBuilder getEventOrBuilder();
}
|
yuvallanger/glue | glue/core/session.py | <gh_stars>0
from __future__ import absolute_import, division, print_function
from . import DataCollection, CommandStack
class Session(object):
def __init__(self, application=None, data_collection=None,
command_stack=None, hub=None):
# applications can be added after instantiation
self.application = application
self.data_collection = data_collection or DataCollection()
self.hub = self.data_collection.hub
self.command_stack = command_stack or CommandStack()
self.command_stack.session = self
# set the global data_collection for subset updates
from .edit_subset_mode import EditSubsetMode
EditSubsetMode().data_collection = self.data_collection
|
hmcts/ia-case-notifications-api | src/main/java/uk/gov/hmcts/reform/iacasenotificationsapi/domain/personalisation/caseofficer/CaseOfficerAsyncStitchingHomeOfficeNotificationFailedPersonalisation.java | package uk.gov.hmcts.reform.iacasenotificationsapi.domain.personalisation.caseofficer;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import javax.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.iacasenotificationsapi.domain.entities.AsylumCase;
import uk.gov.hmcts.reform.iacasenotificationsapi.domain.personalisation.EmailNotificationPersonalisation;
import uk.gov.hmcts.reform.iacasenotificationsapi.infrastructure.EmailAddressFinder;
import uk.gov.hmcts.reform.iacasenotificationsapi.infrastructure.PersonalisationProvider;
@Service
public class CaseOfficerAsyncStitchingHomeOfficeNotificationFailedPersonalisation implements EmailNotificationPersonalisation {
private final String asyncStitchingHomeOfficeNotificationFailedTemplateId;
private EmailAddressFinder emailAddressFinder;
private final PersonalisationProvider personalisationProvider;
public CaseOfficerAsyncStitchingHomeOfficeNotificationFailedPersonalisation(
@NotNull(message = "asyncStitchingHomeOfficeNotificationFailedTemplateId cannot be null")
@Value("${govnotify.template.asyncStitchingHomeOfficeNotificationFailed.caseOfficer.email}") String asyncStitchingHomeOfficeNotificationFailedTemplateId,
PersonalisationProvider personalisationProvider,
EmailAddressFinder emailAddressFinder) {
this.asyncStitchingHomeOfficeNotificationFailedTemplateId = asyncStitchingHomeOfficeNotificationFailedTemplateId;
this.personalisationProvider = personalisationProvider;
this.emailAddressFinder = emailAddressFinder;
}
@Override
public String getTemplateId() {
return asyncStitchingHomeOfficeNotificationFailedTemplateId;
}
@Override
public Set<String> getRecipientsList(AsylumCase asylumCase) {
return Collections.singleton(emailAddressFinder.getListCaseHearingCentreEmailAddress(asylumCase));
}
@Override
public String getReferenceId(Long caseId) {
return caseId + "_STITCHING_BUNDLE_HO_NOTIFICATION_FAILED_CASE_OFFICER";
}
@Override
public Map<String, String> getPersonalisation(AsylumCase asylumCase) {
return this.personalisationProvider.getTribunalHeaderPersonalisation(asylumCase);
}
}
|
qinjidong/EasyMPlayer | mplayer/libvo/aspect.h | <filename>mplayer/libvo/aspect.h<gh_stars>0
/*
* This file is part of MPlayer.
*
* MPlayer 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.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPLAYER_ASPECT_H
#define MPLAYER_ASPECT_H
/* Stuff for correct aspect scaling. */
extern int vo_panscan_x;
extern int vo_panscan_y;
extern float vo_panscan_amount;
extern float monitor_aspect;
extern float force_monitor_aspect;
extern float monitor_pixel_aspect;
extern float vo_panscanrange;
void panscan_init(void);
void panscan_calc(void);
void panscan_calc_windowed(void);
void aspect_save_orig(int orgw, int orgh);
void aspect_save_prescale(int prew, int preh);
void aspect_save_screenres(int scrw, int scrh);
#define A_WINZOOM 2 ///< zoom to fill window size
#define A_ZOOM 1
#define A_NOZOOM 0
void aspect(int *srcw, int *srch, int zoom);
void aspect_fit(int *srcw, int *srch, int fitw, int fith);
#endif /* MPLAYER_ASPECT_H */
|
Siebes/handlebars.java | handlebars/src/test/java/com/github/jknack/handlebars/io/ClassPathTemplateLoaderTest.java | /**
* Copyright (c) 2012 <NAME>
*
* This file is part of Handlebars.java.
*
* 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.github.jknack.handlebars.io;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.junit.Test;
/**
* Unit test for {@link ClassPathTemplateLoader}.
*
* @author edgar.espina
* @since 0.1.0
*/
public class ClassPathTemplateLoaderTest {
@Test
public void source() throws IOException {
TemplateLoader loader = new ClassPathTemplateLoader();
TemplateSource source = loader.sourceAt("template");
assertNotNull(source);
}
@Test
public void subFolder() throws IOException {
URLTemplateLoader loader = new ClassPathTemplateLoader();
loader.setSuffix(".yml");
TemplateSource source = loader.sourceAt("mustache/specs/comments");
assertNotNull(source);
}
@Test
public void subFolderwithDashAtBeginning() throws IOException {
URLTemplateLoader loader = new ClassPathTemplateLoader();
loader.setSuffix(".yml");
TemplateSource source = loader.sourceAt("/mustache/specs/comments");
assertNotNull(source);
}
@Test(expected = FileNotFoundException.class)
public void failLocate() throws IOException {
TemplateLoader loader = new ClassPathTemplateLoader();
loader.sourceAt("notExist");
}
@Test
public void setBasePath() throws IOException {
TemplateLoader loader = new ClassPathTemplateLoader("/mustache/specs", ".yml");
TemplateSource source = loader.sourceAt("comments");
assertNotNull(source);
}
@Test
public void setBasePathWithDashDash() throws IOException {
TemplateLoader loader = new ClassPathTemplateLoader("/mustache/specs/", ".yml");
TemplateSource source = loader.sourceAt("comments");
assertNotNull(source);
}
@Test
public void nullSuffix() throws IOException {
assertEquals("suffix should be optional",
new ClassPathTemplateLoader("/", null).sourceAt("noextension").content(StandardCharsets.UTF_8));
assertEquals("template.hbs",
new ClassPathTemplateLoader("/", null).sourceAt("template.hbs").content(StandardCharsets.UTF_8));
}
@Test
public void emptySuffix() throws IOException {
assertEquals("suffix should be optional",
new ClassPathTemplateLoader("/", "").sourceAt("noextension").content(StandardCharsets.UTF_8));
assertEquals("template.hbs",
new ClassPathTemplateLoader("/", "").sourceAt("template.hbs").content(StandardCharsets.UTF_8));
}
}
|
lifecontrol/cattle | code/framework/async/src/main/java/io/cattle/platform/async/retry/RetryTimeoutService.java | <reponame>lifecontrol/cattle<filename>code/framework/async/src/main/java/io/cattle/platform/async/retry/RetryTimeoutService.java
package io.cattle.platform.async.retry;
public interface RetryTimeoutService {
Object submit(Retry retry);
void completed(Object obj);
}
|
urbanairship/android-library | urbanairship-core/src/main/java/com/urbanairship/remoteconfig/ModuleAdapter.java | /* Copyright Airship and Contributors */
package com.urbanairship.remoteconfig;
import android.util.SparseArray;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.urbanairship.AirshipComponent;
import com.urbanairship.AirshipComponentGroups;
import com.urbanairship.Logger;
import com.urbanairship.UAirship;
import com.urbanairship.json.JsonMap;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* Used by {@link RemoteConfigManager} to handle mapping modules to airship components.
*/
class ModuleAdapter {
private SparseArray<Set<AirshipComponent>> componentGroupMap = null;
/**
* Enables/disables airship components that map to the module name.
*
* @param module The module name.
* @param enabled {@code true} to enable, {@code false} to disable.
*/
public void setComponentEnabled(@NonNull String module, boolean enabled) {
for (AirshipComponent component : findAirshipComponents(module)) {
component.setComponentEnabled(enabled);
}
}
/**
* Notifies airship components that they have new config.
*
* @param module The module name.
* @param config The config
*/
public void onNewConfig(@NonNull String module, @Nullable JsonMap config) {
for (AirshipComponent component : findAirshipComponents(module)) {
if (component.isComponentEnabled()) {
component.onNewConfig(config);
}
}
}
/**
* Maps the disable info module to airship components.
*
* @param module The module.
* @return The matching airship components.
*/
@NonNull
private Collection<? extends AirshipComponent> findAirshipComponents(@NonNull String module) {
switch (module) {
case Modules.LOCATION_MODULE:
return getComponentsByGroup(AirshipComponentGroups.LOCATION);
case Modules.ANALYTICS_MODULE:
return getComponentsByGroup(AirshipComponentGroups.ANALYTICS);
case Modules.AUTOMATION_MODULE:
return getComponentsByGroup(AirshipComponentGroups.ACTION_AUTOMATION);
case Modules.IN_APP_MODULE:
return getComponentsByGroup(AirshipComponentGroups.IN_APP);
case Modules.MESSAGE_CENTER:
return getComponentsByGroup(AirshipComponentGroups.MESSAGE_CENTER);
case Modules.PUSH_MODULE:
return getComponentsByGroup(AirshipComponentGroups.PUSH);
case Modules.NAMED_USER_MODULE:
return getComponentsByGroup(AirshipComponentGroups.NAMED_USER);
case Modules.CHANNEL_MODULE:
return getComponentsByGroup(AirshipComponentGroups.CHANNEL);
case Modules.CHAT_MODULE:
return getComponentsByGroup(AirshipComponentGroups.CHAT);
case Modules.CONTACT_MODULE:
return getComponentsByGroup(AirshipComponentGroups.CONTACT);
case Modules.PREFERENCE_CENTER_MODULE:
return getComponentsByGroup(AirshipComponentGroups.PREFERENCE_CENTER);
}
Logger.verbose("Unable to find module: %s", module);
return Collections.emptyList();
}
@NonNull
private Set<AirshipComponent> getComponentsByGroup(@AirshipComponentGroups.Group int group) {
if (componentGroupMap == null) {
componentGroupMap = createComponentGroupMap(UAirship.shared().getComponents());
}
return componentGroupMap.get(group, Collections.<AirshipComponent>emptySet());
}
@NonNull
private static SparseArray<Set<AirshipComponent>> createComponentGroupMap(@NonNull Collection<AirshipComponent> components) {
SparseArray<Set<AirshipComponent>> componentMap = new SparseArray<>();
for (AirshipComponent component : components) {
Set<AirshipComponent> group = componentMap.get(component.getComponentGroup());
if (group == null) {
group = new HashSet<>();
componentMap.put(component.getComponentGroup(), group);
}
group.add(component);
}
return componentMap;
}
}
|
madisoncarr/grace-shopper-project | client/store/singleOrderMgmt.js | <reponame>madisoncarr/grace-shopper-project
import axios from 'axios'
const GET_SINGLE_ORDER = 'GET_SINGLE_ORDER'
const getSingleOrder = singleOrder => {
return {
type: GET_SINGLE_ORDER,
singleOrder
}
}
export default function singleOrderManagementReducer(state = {}, action) {
switch (action.type) {
case GET_SINGLE_ORDER:
return action.singleOrder
default:
return state
}
}
export const fetchSingleOrder = orderId => {
return async dispatch => {
try {
const {data} = await axios.get(`/api/admin/orders/${orderId}`)
dispatch(getSingleOrder(data))
} catch (err) {
console.log(err)
}
}
}
|
tristantarrant/cpp-client | src/hotrod/impl/configuration/ConfigurationChildBuilder.cpp | #include "infinispan/hotrod/ConfigurationChildBuilder.h"
#include "infinispan/hotrod/ConfigurationBuilder.h"
namespace infinispan {
namespace hotrod {
ConfigurationChildBuilder::ConfigurationChildBuilder(ConfigurationBuilder& builder_) :
m_builder(builder_) {
}
ServerConfigurationBuilder& ConfigurationChildBuilder::addServer() {
return m_builder.addServer();
}
ConfigurationBuilder& ConfigurationChildBuilder::addServers(std::string servers) {
return m_builder.addServers(servers);
}
ConnectionPoolConfigurationBuilder& ConfigurationChildBuilder::connectionPool() {
return m_builder.connectionPool();
}
ConfigurationBuilder& ConfigurationChildBuilder::connectionTimeout(int connectionTimeout_) {
return m_builder.connectionTimeout(connectionTimeout_);
}
ConfigurationBuilder& ConfigurationChildBuilder::forceReturnValues(bool forceReturnValues_) {
return m_builder.forceReturnValues(forceReturnValues_);
}
ConfigurationBuilder& ConfigurationChildBuilder::keySizeEstimate(int keySizeEstimate_) {
return m_builder.keySizeEstimate(keySizeEstimate_);
}
ConfigurationBuilder& ConfigurationChildBuilder::pingOnStartup(bool pingOnStartup_) {
return m_builder.pingOnStartup(pingOnStartup_);
}
ConfigurationBuilder& ConfigurationChildBuilder::protocolVersion(std::string protocolVersion_) {
return m_builder.protocolVersion(protocolVersion_);
}
ConfigurationBuilder& ConfigurationChildBuilder::socketTimeout(int socketTimeout_) {
return m_builder.socketTimeout(socketTimeout_);
}
SslConfigurationBuilder& ConfigurationChildBuilder::ssl() {
return m_builder.ssl();
}
ConfigurationBuilder& ConfigurationChildBuilder::tcpNoDelay(bool tcpNoDelay_) {
return m_builder.tcpNoDelay(tcpNoDelay_);
}
ConfigurationBuilder& ConfigurationChildBuilder::valueSizeEstimate(int valueSizeEstimate_) {
return m_builder.valueSizeEstimate(valueSizeEstimate_);
}
Configuration ConfigurationChildBuilder::build() {
return m_builder.build();
}
}} // namespace
|
mats9693/leetcode | solutions/1-1000/1-100/81-90/86/main.go | package mario
type ListNode struct {
Val int
Next *ListNode
}
func partition(head *ListNode, x int) *ListNode {
if head == nil || head.Next == nil {
return head
}
smallPre := &ListNode{}
s := smallPre
bigPre := &ListNode{}
st := smallPre
bt := bigPre
for head != nil {
node := &ListNode{Val: head.Val}
if node.Val < x {
st.Next = node
st = st.Next
s = s.Next
} else {
bt.Next = node
bt = bt.Next
}
head = head.Next
}
s.Next = bigPre.Next
return smallPre.Next
}
|
bydan/pre | erp_ejb/src_inventario/com/bydan/erp/inventario/business/logic/MarcaProductoLogic.java | <filename>erp_ejb/src_inventario/com/bydan/erp/inventario/business/logic/MarcaProductoLogic.java
/*
*AVISO LEGAL
© Copyright
*Este programa esta protegido por la ley de derechos de autor.
*La reproduccion o distribucion ilicita de este programa o de cualquiera de
*sus partes esta penado por la ley con severas sanciones civiles y penales,
*y seran objeto de todas las sanciones legales que correspondan.
*Su contenido no puede copiarse para fines comerciales o de otras,
*ni puede mostrarse, incluso en una version modificada, en otros sitios Web.
Solo esta permitido colocar hipervinculos al sitio web.
*/
package com.bydan.erp.inventario.business.logic;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
import java.util.ArrayList;
import java.sql.Timestamp;
import java.sql.SQLException;
import java.util.Date;
import java.util.Calendar;
import org.json.JSONArray;
import org.json.JSONObject;
import org.apache.log4j.Logger;
//VALIDACION
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
import com.bydan.framework.ConstantesCommon;
import com.bydan.framework.erp.business.entity.GeneralEntityLogic;
import com.bydan.framework.erp.business.entity.Classe;
import com.bydan.framework.erp.business.entity.DatoGeneral;
import com.bydan.framework.erp.business.entity.DatoGeneralMinimo;
import com.bydan.framework.erp.business.entity.DatoGeneralMaximo;
import com.bydan.framework.erp.business.logic.*;
import com.bydan.framework.erp.util.*;
import com.bydan.erp.inventario.util.*;
import com.bydan.erp.inventario.util.MarcaProductoConstantesFunciones;
import com.bydan.erp.inventario.util.MarcaProductoParameterReturnGeneral;
//import com.bydan.erp.inventario.util.MarcaProductoParameterGeneral;
import com.bydan.erp.inventario.business.entity.MarcaProducto;
import com.bydan.erp.inventario.business.logic.MarcaProductoLogicAdditional;
import com.bydan.erp.inventario.business.dataaccess.*;
import com.bydan.erp.inventario.business.entity.*;
import com.bydan.erp.seguridad.business.entity.*;
import com.bydan.erp.seguridad.business.entity.*;
import com.bydan.erp.facturacion.business.entity.*;
import com.bydan.erp.cartera.business.entity.*;
import com.bydan.erp.seguridad.business.logic.*;
import com.bydan.erp.facturacion.business.logic.*;
import com.bydan.erp.cartera.business.logic.*;
import com.bydan.erp.seguridad.util.*;
import com.bydan.erp.facturacion.util.*;
import com.bydan.erp.cartera.util.*;
import com.bydan.erp.seguridad.business.dataaccess.*;
import com.bydan.erp.facturacion.business.dataaccess.*;
import com.bydan.erp.cartera.business.dataaccess.*;
@SuppressWarnings("unused")
public class MarcaProductoLogic extends GeneralEntityLogic {
static Logger logger = Logger.getLogger(MarcaProductoLogic.class);
protected MarcaProductoDataAccess marcaproductoDataAccess;
protected MarcaProducto marcaproducto;
protected List<MarcaProducto> marcaproductos;
protected Object marcaproductoObject;
protected List<Object> marcaproductosObject;
public static ClassValidator<MarcaProducto> marcaproductoValidator = new ClassValidator<MarcaProducto>(MarcaProducto.class);
public InvalidValue[] invalidValues=null;
public StringBuilder stringBuilder=new StringBuilder();
public Boolean conMostrarMensajesStringBuilder=true;
protected MarcaProductoLogicAdditional marcaproductoLogicAdditional=null;
public MarcaProductoLogicAdditional getMarcaProductoLogicAdditional() {
return this.marcaproductoLogicAdditional;
}
public void setMarcaProductoLogicAdditional(MarcaProductoLogicAdditional marcaproductoLogicAdditional) {
try {
this.marcaproductoLogicAdditional=marcaproductoLogicAdditional;
} catch(Exception e) {
;
}
}
/*
protected ArrayList<DatoGeneral> arrDatoGeneral;
protected Connexion connexion;
protected DatosCliente datosCliente;
protected ConnexionType connexionType;
protected ParameterDbType parameterDbType;
protected EntityManagerFactory entityManagerFactory;
protected DatosDeep datosDeep;
protected Boolean isConDeep=false;
*/
public MarcaProductoLogic()throws SQLException,Exception {
super();
try {
this.marcaproductoDataAccess = new MarcaProductoDataAccess();
this.marcaproductos= new ArrayList<MarcaProducto>();
this.marcaproducto= new MarcaProducto();
this.marcaproductoObject=new Object();
this.marcaproductosObject=new ArrayList<Object>();
/*
this.connexion=new Connexion();
this.datosCliente=new DatosCliente();
this.arrDatoGeneral= new ArrayList<DatoGeneral>();
//INICIALIZA PARAMETROS CONEXION
this.connexionType=Constantes.CONNEXIONTYPE;
this.parameterDbType=Constantes.PARAMETERDBTYPE;
if(Constantes.CONNEXIONTYPE.equals(ConnexionType.HIBERNATE)) {
this.entityManagerFactory=ConstantesCommon.JPAENTITYMANAGERFACTORY;
}
this.datosDeep=new DatosDeep();
this.isConDeep=false;
*/
this.marcaproductoDataAccess.setConnexionType(this.connexionType);
this.marcaproductoDataAccess.setParameterDbType(this.parameterDbType);
this.invalidValues=new InvalidValue[0];
this.stringBuilder=new StringBuilder();
this.conMostrarMensajesStringBuilder=true;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public MarcaProductoLogic(Connexion newConnexion)throws Exception {
super(newConnexion);
try {
//this.connexion=newConnexion;
this.marcaproductoDataAccess = new MarcaProductoDataAccess();
this.marcaproductos= new ArrayList<MarcaProducto>();
this.marcaproducto= new MarcaProducto();
this.marcaproductoObject=new Object();
this.marcaproductosObject=new ArrayList<Object>();
/*
this.datosCliente=new DatosCliente();
this.arrDatoGeneral= new ArrayList<DatoGeneral>();
//INICIALIZA PARAMETROS CONEXION
this.connexionType=Constantes.CONNEXIONTYPE;
this.parameterDbType=Constantes.PARAMETERDBTYPE;
if(Constantes.CONNEXIONTYPE.equals(ConnexionType.HIBERNATE)) {
this.entityManagerFactory=ConstantesCommon.JPAENTITYMANAGERFACTORY;
}
this.datosDeep=new DatosDeep();
this.isConDeep=false;
*/
this.marcaproductoDataAccess.setConnexionType(this.connexionType);
this.marcaproductoDataAccess.setParameterDbType(this.parameterDbType);
this.invalidValues=new InvalidValue[0];
this.stringBuilder=new StringBuilder();
this.conMostrarMensajesStringBuilder=true;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public MarcaProducto getMarcaProducto() throws Exception {
MarcaProductoLogicAdditional.checkMarcaProductoToGet(marcaproducto,this.datosCliente,this.arrDatoGeneral);
MarcaProductoLogicAdditional.updateMarcaProductoToGet(marcaproducto,this.arrDatoGeneral);
return marcaproducto;
}
public void setMarcaProducto(MarcaProducto newMarcaProducto) {
this.marcaproducto = newMarcaProducto;
}
public MarcaProductoDataAccess getMarcaProductoDataAccess() {
return marcaproductoDataAccess;
}
public void setMarcaProductoDataAccess(MarcaProductoDataAccess newmarcaproductoDataAccess) {
this.marcaproductoDataAccess = newmarcaproductoDataAccess;
}
public List<MarcaProducto> getMarcaProductos() throws Exception {
this.quitarMarcaProductosNulos();
MarcaProductoLogicAdditional.checkMarcaProductoToGets(marcaproductos,this.datosCliente,this.arrDatoGeneral);
for (MarcaProducto marcaproductoLocal: marcaproductos ) {
MarcaProductoLogicAdditional.updateMarcaProductoToGet(marcaproductoLocal,this.arrDatoGeneral);
}
return marcaproductos;
}
public void setMarcaProductos(List<MarcaProducto> newMarcaProductos) {
this.marcaproductos = newMarcaProductos;
}
public Object getMarcaProductoObject() {
this.marcaproductoObject=this.marcaproductoDataAccess.getEntityObject();
return this.marcaproductoObject;
}
public void setMarcaProductoObject(Object newMarcaProductoObject) {
this.marcaproductoObject = newMarcaProductoObject;
}
public List<Object> getMarcaProductosObject() {
this.marcaproductosObject=this.marcaproductoDataAccess.getEntitiesObject();
return this.marcaproductosObject;
}
public void setMarcaProductosObject(List<Object> newMarcaProductosObject) {
this.marcaproductosObject = newMarcaProductosObject;
}
/*
public Connexion getConnexion() {
return this.connexion;
}
public void setConnexion(Connexion newConnexion) {
this.connexion=newConnexion;
}
public DatosCliente getDatosCliente() {
return datosCliente;
}
*/
public void setDatosCliente(DatosCliente datosCliente) {
this.datosCliente = datosCliente;
if(this.marcaproductoDataAccess!=null) {
this.marcaproductoDataAccess.setDatosCliente(datosCliente);
}
}
/*
public DatosDeep getDatosDeep() {
return this.datosDeep;
}
public void setDatosDeep(DatosDeep datosDeep) {
this.datosDeep = datosDeep;
}
public void setDatosDeepFromDatosCliente() {
this.datosDeep = this.datosCliente.getDatosDeep();
this.isConDeep=this.datosCliente.getIsConDeep();
}
public Boolean getIsConDeep() {
return this.isConDeep;
}
public void setIsConDeep(Boolean isConDeep) {
this.isConDeep = isConDeep;
}
public ArrayList<DatoGeneral> getArrDatoGeneral() {
return arrDatoGeneral;
}
public void setArrDatoGeneral(ArrayList<DatoGeneral> arrDatoGeneral) {
this.arrDatoGeneral = arrDatoGeneral;
}
public ConnexionType getConnexionType() {
return connexionType;
}
public void setConnexionType(ConnexionType connexionType) {
this.connexionType = connexionType;
}
public ParameterDbType getParameterDbType() {
return parameterDbType;
}
public void setParameterDbType(ParameterDbType parameterDbType) {
this.parameterDbType = parameterDbType;
}
public EntityManagerFactory getEntityManagerFactory() {
return entityManagerFactory;
}
public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}
*/
public void setDatosDeepParametros(Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases,String strTituloMensaje) {
this.datosDeep.setIsDeep(isDeep);
this.datosDeep.setDeepLoadType(deepLoadType);
this.datosDeep.setClases(clases);
this.datosDeep.setSTituloMensaje(strTituloMensaje);
}
public InvalidValue[] getInvalidValues() {
return invalidValues;
}
public void setInvalidValues(InvalidValue[] invalidValues) {
this.invalidValues = invalidValues;
}
public StringBuilder getStringBuilder() {
return this.stringBuilder;
}
public void setStringBuilder(StringBuilder stringBuilder) {
this.stringBuilder = stringBuilder;
}
public Boolean getConMostrarMensajesStringBuilder() {
return this.conMostrarMensajesStringBuilder;
}
public void setConMostrarMensajesStringBuilder(Boolean conMostrarMensajesStringBuilder) {
this.conMostrarMensajesStringBuilder = conMostrarMensajesStringBuilder;
}
public void getNewConnexionToDeep()throws Exception {
//this.getNewConnexionToDeep();
try {
this.connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,"");connexion.begin();
} catch(SQLException e) {
Funciones.manageException(logger,e);
throw e;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public void getNewConnexionToDeep(String sDetalle)throws Exception {
try {
this.connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,sDetalle);connexion.begin();
} catch(SQLException e) {
Funciones.manageException(logger,e);
throw e;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public void commitNewConnexionToDeep()throws Exception {
try {
this.connexion.commit();
} catch(SQLException e) {
Funciones.manageException(logger,e);
throw e;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public void rollbackNewConnexionToDeep()throws Exception {
try {
this.connexion.rollback();
} catch(SQLException e) {
Funciones.manageException(logger,e);
throw e;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public void closeNewConnexionToDeep()throws Exception {
try {
this.connexion.close();
} catch(SQLException e) {
Funciones.manageException(logger,e);
throw e;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public void executeQueryWithConnection(String sQueryExecute) throws Exception {
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-executeQueryWithConnection");connexion.begin();
marcaproductoDataAccess.executeQuery(connexion, sQueryExecute);
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void executeQuery(String sQueryExecute) throws Exception {
try {
marcaproductoDataAccess.executeQuery(connexion, sQueryExecute);
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void getEntityWithConnection(Long id) throws Exception {
marcaproducto = new MarcaProducto();
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntityWithConnection");connexion.begin();
marcaproducto=marcaproductoDataAccess.getEntity(connexion, id);
if(this.isConDeep) {
this.deepLoad(this.marcaproducto,this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproducto);
}
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getEntity(Long id) throws Exception {
marcaproducto = new MarcaProducto();
try {
marcaproducto=marcaproductoDataAccess.getEntity(connexion, id);
if(this.isConDeep) {
this.deepLoad(this.marcaproducto,this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproducto);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void getEntityWithConnection(QueryWhereSelectParameters queryWhereSelectParameters) throws Exception {
marcaproducto = new MarcaProducto();
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntityWithConnection");connexion.begin();
marcaproducto=marcaproductoDataAccess.getEntity(connexion, queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoad(this.marcaproducto,this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproducto);
}
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getEntityWithConnection(String sFinalQuery) throws Exception {
marcaproducto = new MarcaProducto();
try {
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
this.getEntityWithConnection(queryWhereSelectParameters);
} catch(Exception e) {
throw e;
} finally {
}
}
public void getEntity(QueryWhereSelectParameters queryWhereSelectParameters) throws Exception {
marcaproducto = new MarcaProducto();
try {
marcaproducto=marcaproductoDataAccess.getEntity(connexion, queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoad(this.marcaproducto,this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproducto);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void getEntity(String sFinalQuery) throws Exception {
marcaproducto = new MarcaProducto();
try {
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
this.getEntity(queryWhereSelectParameters);
} catch(Exception e) {
throw e;
} finally {
;
}
}
public DatoGeneralMinimo getEntityDatoGeneralMinimoGenericoWithConnection(String sSelectQuery,String sFinalQuery,ArrayList<Classe> classes) throws Exception {
marcaproducto = new MarcaProducto();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
DatoGeneralMinimo datoGeneralMinimo = new DatoGeneralMinimo();
try {
queryWhereSelectParameters.setSelectQuery(sSelectQuery);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntityDatoGeneralMinimoGenericoWithConnection");connexion.begin();
datoGeneralMinimo =marcaproductoDataAccess.getEntityDatoGeneralMinimoGenerico(connexion, queryWhereSelectParameters,classes);
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
return datoGeneralMinimo;
}
public DatoGeneralMinimo getEntityDatoGeneralMinimoGenerico(String sSelectQuery,String sFinalQuery,ArrayList<Classe> classes) throws Exception {
marcaproducto = new MarcaProducto();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
DatoGeneralMinimo datoGeneralMinimo = new DatoGeneralMinimo();
try {
queryWhereSelectParameters.setSelectQuery(sSelectQuery);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
datoGeneralMinimo=marcaproductoDataAccess.getEntityDatoGeneralMinimoGenerico(connexion, queryWhereSelectParameters,classes);
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
return datoGeneralMinimo;
}
public ArrayList<DatoGeneral> getEntitiesDatoGeneralGenericoWithConnection(String sSelectQuery,String sFinalQuery,ArrayList<Classe> classes) throws Exception {
marcaproducto = new MarcaProducto();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
ArrayList<DatoGeneral> datoGenerals = new ArrayList<DatoGeneral>();
try {
queryWhereSelectParameters.setSelectQuery(sSelectQuery);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntitiesDatoGeneralGenericoWithConnection");connexion.begin();
datoGenerals =marcaproductoDataAccess.getEntitiesDatoGeneralGenerico(connexion, queryWhereSelectParameters,classes);
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
return datoGenerals;
}
public ArrayList<DatoGeneral> getEntitiesDatoGeneralGenerico(String sSelectQuery,String sFinalQuery,ArrayList<Classe> classes) throws Exception {
marcaproducto = new MarcaProducto();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
ArrayList<DatoGeneral> datoGenerals = new ArrayList<DatoGeneral>();
try {
queryWhereSelectParameters.setSelectQuery(sSelectQuery);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
datoGenerals=marcaproductoDataAccess.getEntitiesDatoGeneralGenerico(connexion, queryWhereSelectParameters,classes);
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
return datoGenerals;
}
public ArrayList<DatoGeneralMaximo> getEntitiesDatoGeneralMaximoGenericoWithConnection(String sSelectQuery,String sFinalQuery,ArrayList<Classe> classes) throws Exception {
marcaproducto = new MarcaProducto();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
ArrayList<DatoGeneralMaximo> datoGeneralMaximos = new ArrayList<DatoGeneralMaximo>();
try {
queryWhereSelectParameters.setSelectQuery(sSelectQuery);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntitiesDatoGeneralMaximoGenericoWithConnection");connexion.begin();
datoGeneralMaximos =marcaproductoDataAccess.getEntitiesDatoGeneralMaximoGenerico(connexion, queryWhereSelectParameters,classes);
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
return datoGeneralMaximos;
}
public ArrayList<DatoGeneralMaximo> getEntitiesDatoGeneralMaximoGenerico(String sSelectQuery,String sFinalQuery,ArrayList<Classe> classes) throws Exception {
marcaproducto = new MarcaProducto();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
ArrayList<DatoGeneralMaximo> datoGeneralMaximos = new ArrayList<DatoGeneralMaximo>();
try {
queryWhereSelectParameters.setSelectQuery(sSelectQuery);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
datoGeneralMaximos=marcaproductoDataAccess.getEntitiesDatoGeneralMaximoGenerico(connexion, queryWhereSelectParameters,classes);
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
return datoGeneralMaximos;
}
public void getEntitiesWithConnection(QueryWhereSelectParameters queryWhereSelectParameters)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntitiesWithConnection");connexion.begin();
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIES","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion, queryWhereSelectParameters);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getEntitiesWithConnection(String sFinalQuery)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
this.getEntitiesWithConnection(queryWhereSelectParameters);
} catch(Exception e) {
throw e;
} finally {
}
}
public void getEntities(QueryWhereSelectParameters queryWhereSelectParameters)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIES","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion, queryWhereSelectParameters);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void getEntities(String sFinalQuery)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
this.getEntities(queryWhereSelectParameters);
} catch(Exception e) {
throw e;
} finally {
;
}
}
public void getEntitiesWithConnection(String sQuerySelect,QueryWhereSelectParameters queryWhereSelectParameters)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntitiesWithConnection");connexion.begin();
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIESWITHSELECT","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,sQuerySelect, queryWhereSelectParameters);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getEntities(String sQuerySelect,QueryWhereSelectParameters queryWhereSelectParameters)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIESWITHSELECT","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,sQuerySelect, queryWhereSelectParameters);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
/**
* Trae cualquier tipo de query select
* @conMapGenerico Si es true, trae todo como objeto generico, Si es false trae query en campos de la clase, usando unicamente los determinados en listColumns y deepLoadType
* @deepLoadType Si conMapGenerico es false trae query select con las columnas de listColumns, incluyento o excludendo deacuerdo a deepLoadType
*/
public void getEntitiesWithConnection(String sQuerySelect,String sFinalQuery,List<String> listColumns,DeepLoadType deepLoadType,Boolean conMapGenerico)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntitiesWithConnection");connexion.begin();
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIESWITHSELECT","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,sQuerySelect, queryWhereSelectParameters,listColumns,deepLoadType,conMapGenerico);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getEntities(String sQuerySelect,String sFinalQuery,List<String> listColumns,DeepLoadType deepLoadType,Boolean conMapGenerico)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
try {
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIESWITHSELECT","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,sQuerySelect, queryWhereSelectParameters,listColumns,deepLoadType,conMapGenerico);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void getEntityWithConnection(String sQuerySelect,String sFinalQuery,List<String> listColumns,DeepLoadType deepLoadType,Boolean conMapGenerico)throws Exception {
marcaproducto = new MarcaProducto();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntityWithConnection");connexion.begin();
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIESWITHSELECT","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproducto=marcaproductoDataAccess.getEntity(connexion,sQuerySelect, queryWhereSelectParameters,listColumns,deepLoadType,conMapGenerico);
this.validarGuardarManejarMarcaProducto(marcaproducto);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproducto);
}
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getEntity(String sQuerySelect,String sFinalQuery,List<String> listColumns,DeepLoadType deepLoadType,Boolean conMapGenerico)throws Exception {
marcaproducto = new MarcaProducto();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters();
try {
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIESWITHSELECT","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproducto=marcaproductoDataAccess.getEntity(connexion,sQuerySelect, queryWhereSelectParameters,listColumns,deepLoadType,conMapGenerico);
this.validarGuardarManejarMarcaProducto(marcaproducto);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproducto);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void getEntitiesSimpleQueryBuildWithConnection(String sQuerySelect,QueryWhereSelectParameters queryWhereSelectParameters)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getEntitiesSimpleQueryBuildWithConnection");connexion.begin();
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIESSIMPLEQUERY","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntitiesSimpleQueryBuild(connexion,sQuerySelect, queryWhereSelectParameters);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getEntitiesSimpleQueryBuild(String sQuerySelect,QueryWhereSelectParameters queryWhereSelectParameters)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"GETENTITIESSIMPLEQUERY","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntitiesSimpleQueryBuild(connexion,sQuerySelect, queryWhereSelectParameters);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void getTodosMarcaProductosWithConnection(String sFinalQuery,Pagination pagination)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getTodosMarcaProductosWithConnection");connexion.begin();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters("");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"TODOS","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getTodosMarcaProductos(String sFinalQuery,Pagination pagination)throws Exception {
marcaproductos = new ArrayList<MarcaProducto>();
try {
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters("");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"TODOS","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
this.validarGuardarManejarMarcaProducto(marcaproductos);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public Boolean validarGuardarMarcaProducto(MarcaProducto marcaproducto) throws Exception {
Boolean estaValidado=false;
if(marcaproducto.getIsNew() || marcaproducto.getIsChanged()) {
this.invalidValues = marcaproductoValidator.getInvalidValues(marcaproducto);
if(this.invalidValues==null || this.invalidValues.length<=0) {
estaValidado=true;
} else {
this.guardarInvalidValues(marcaproducto);
}
} else {
estaValidado=true;
}
return estaValidado;
}
public Boolean validarGuardarMarcaProducto(List<MarcaProducto> MarcaProductos) throws Exception {
Boolean estaValidado=true;
Boolean estaValidadoObjeto=false;
for(MarcaProducto marcaproductoLocal:marcaproductos) {
estaValidadoObjeto=this.validarGuardarMarcaProducto(marcaproductoLocal);
if(!estaValidadoObjeto) {
if(estaValidado) {
estaValidado=false;
}
}
}
return estaValidado;
}
public void validarGuardarManejarMarcaProducto(List<MarcaProducto> MarcaProductos) throws Exception {
if(Constantes2.ISDEVELOPING_VALIDACIONDATOS_TRAER) {
if(!this.validarGuardarMarcaProducto(marcaproductos)) {
//SE GENERA EXCEPTION
if(this.conMostrarMensajesStringBuilder) {
this.manejarMensajesStringBuilder(ConstantesMensajes.SMENSAJEEXCEPCION_VALIDACIONDATOS);
}
}
}
}
public void validarGuardarManejarMarcaProducto(MarcaProducto MarcaProducto) throws Exception {
if(Constantes2.ISDEVELOPING_VALIDACIONDATOS_TRAER) {
if(!this.validarGuardarMarcaProducto(marcaproducto)) {
//SE GENERA EXCEPTION
if(this.conMostrarMensajesStringBuilder) {
this.manejarMensajesStringBuilder(ConstantesMensajes.SMENSAJEEXCEPCION_VALIDACIONDATOS);
}
}
}
}
public void guardarInvalidValues(MarcaProducto marcaproducto) throws Exception {
String sCampo="";
String sMensajeCampo="";
String sMensaje="";
String sIdMensaje="";
sIdMensaje="\r\nID="+marcaproducto.getId();
sMensaje+=sIdMensaje;
for (InvalidValue invalidValue : this.invalidValues) {
sCampo=MarcaProductoConstantesFunciones.getMarcaProductoLabelDesdeNombre(invalidValue.getPropertyName());
sMensajeCampo=invalidValue.getMessage();
sMensaje+="\r\n"+sCampo+"->"+sMensajeCampo;
//MOSTRAR CAMPOS INVALIDOS
}
if(!sMensaje.equals("")) {
this.stringBuilder.append(sMensaje);
}
}
public void manejarMensajesStringBuilder(String sMensajeExcepcion) throws Exception {
String sMensajeDetalleExcepcion="";
sMensajeDetalleExcepcion=this.stringBuilder.toString();
if(!sMensajeDetalleExcepcion.equals("")) {
Funciones.manageException(logger,this.stringBuilder,this.datosCliente.getDatosExportar().getsPath(),"marcaproducto","validar_datos");
if(ConstantesMensajes.CON_MOSTRAR_MENSAJES_DETALLE) {
throw new Exception(MarcaProductoConstantesFunciones.SCLASSWEBTITULO + sMensajeDetalleExcepcion);//ConstantesMensajes.SMENSAJEEXCEPCION_VALIDACIONDATOS
} else {
throw new Exception(MarcaProductoConstantesFunciones.SCLASSWEBTITULO + sMensajeExcepcion);//ConstantesMensajes.SMENSAJEEXCEPCION_VALIDACIONDATOS
}
}
}
public void saveMarcaProductoWithConnection()throws Exception {
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-saveMarcaProductoWithConnection");connexion.begin();
MarcaProductoLogicAdditional.checkMarcaProductoToSave(this.marcaproducto,this.datosCliente,connexion,this.arrDatoGeneral);
MarcaProductoLogicAdditional.updateMarcaProductoToSave(this.marcaproducto,this.arrDatoGeneral);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),this.marcaproducto,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
//TEMPORAL
//this.getSetVersionRowMarcaProducto();
this.stringBuilder=new StringBuilder();
if(this.validarGuardarMarcaProducto(this.marcaproducto)) {
MarcaProductoDataAccess.save(this.marcaproducto, connexion);
} else {
//SE GENERA EXCEPTION
if(this.conMostrarMensajesStringBuilder) {
this.manejarMensajesStringBuilder(ConstantesMensajes.SMENSAJEEXCEPCION_VALIDACIONDATOS);
}
}
if(this.isConDeep) {
this.deepSave(this.marcaproducto,this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases());
}
MarcaProductoLogicAdditional.checkMarcaProductoToSaveAfter(this.marcaproducto,this.datosCliente,connexion,this.arrDatoGeneral);
//SOLO FUNCIONA PARA ACTUALIZAR Y CON CONNEXION
this.getSetVersionRowMarcaProducto();
connexion.commit();
if(this.marcaproducto.getIsDeleted()) {
this.marcaproducto=null;
}
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void saveMarcaProducto()throws Exception {
try {
MarcaProductoLogicAdditional.checkMarcaProductoToSave(this.marcaproducto,this.datosCliente,connexion,this.arrDatoGeneral);
MarcaProductoLogicAdditional.updateMarcaProductoToSave(this.marcaproducto,this.arrDatoGeneral);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),this.marcaproducto,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
this.stringBuilder=new StringBuilder();
if(this.validarGuardarMarcaProducto(this.marcaproducto)) {
MarcaProductoDataAccess.save(this.marcaproducto, connexion);
} else {
//SE GENERA EXCEPTION
if(this.conMostrarMensajesStringBuilder) {
this.manejarMensajesStringBuilder(ConstantesMensajes.SMENSAJEEXCEPCION_VALIDACIONDATOS);
}
}
if(this.isConDeep) {
this.deepSave(this.marcaproducto,this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases());
}
MarcaProductoLogicAdditional.checkMarcaProductoToSaveAfter(this.marcaproducto,this.datosCliente,connexion,this.arrDatoGeneral);
if(this.marcaproducto.getIsDeleted()) {
this.marcaproducto=null;
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void saveMarcaProductosWithConnection()throws Exception {
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-saveMarcaProductosWithConnection");connexion.begin();
MarcaProductoLogicAdditional.checkMarcaProductoToSaves(marcaproductos,this.datosCliente,connexion,this.arrDatoGeneral);
//TEMPORAL
//this.getSetVersionRowMarcaProductos();
Boolean validadoTodosMarcaProducto=true;
this.stringBuilder=new StringBuilder();
for(MarcaProducto marcaproductoLocal:marcaproductos) {
if(marcaproductoLocal.getsType().contains(Constantes2.S_TOTALES)) {
continue;
}
MarcaProductoLogicAdditional.updateMarcaProductoToSave(marcaproductoLocal,this.arrDatoGeneral);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),marcaproductoLocal,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
if(this.validarGuardarMarcaProducto(marcaproductoLocal)) {
MarcaProductoDataAccess.save(marcaproductoLocal, connexion);
} else {
validadoTodosMarcaProducto=false;
}
}
if(!validadoTodosMarcaProducto) {
//SE GENERA EXCEPTION
if(this.conMostrarMensajesStringBuilder) {
this.manejarMensajesStringBuilder(ConstantesMensajes.SMENSAJEEXCEPCION_VALIDACIONDATOS);
}
}
if(this.isConDeep) {
this.deepSaves(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(), this.datosDeep.getSTituloMensaje());
}
MarcaProductoLogicAdditional.checkMarcaProductoToSavesAfter(marcaproductos,this.datosCliente,connexion,this.arrDatoGeneral);
//SOLO FUNCIONA PARA ACTUALIZAR Y CON CONNEXION
this.getSetVersionRowMarcaProductos();
connexion.commit();
this.quitarMarcaProductosEliminados();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void saveMarcaProductos()throws Exception {
try {
MarcaProductoLogicAdditional.checkMarcaProductoToSaves(marcaproductos,this.datosCliente,connexion,this.arrDatoGeneral);
Boolean validadoTodosMarcaProducto=true;
this.stringBuilder=new StringBuilder();
for(MarcaProducto marcaproductoLocal:marcaproductos) {
if(marcaproductoLocal.getsType().contains(Constantes2.S_TOTALES)) {
continue;
}
MarcaProductoLogicAdditional.updateMarcaProductoToSave(marcaproductoLocal,this.arrDatoGeneral);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),marcaproductoLocal,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
if(this.validarGuardarMarcaProducto(marcaproductoLocal)) {
MarcaProductoDataAccess.save(marcaproductoLocal, connexion);
} else {
validadoTodosMarcaProducto=false;
}
}
if(!validadoTodosMarcaProducto) {
//SE GENERA EXCEPTION
if(this.conMostrarMensajesStringBuilder) {
this.manejarMensajesStringBuilder(ConstantesMensajes.SMENSAJEEXCEPCION_VALIDACIONDATOS);
}
}
if(this.isConDeep) {
this.deepSaves(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(), this.datosDeep.getSTituloMensaje());
}
MarcaProductoLogicAdditional.checkMarcaProductoToSavesAfter(marcaproductos,this.datosCliente,connexion,this.arrDatoGeneral);
this.quitarMarcaProductosEliminados();
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public MarcaProductoParameterReturnGeneral procesarAccionMarcaProductos(ParametroGeneralUsuario parametroGeneralUsuario,Modulo modulo,Opcion opcion,Usuario usuario,String sProceso,List<MarcaProducto> marcaproductos,MarcaProductoParameterReturnGeneral marcaproductoParameterGeneral)throws Exception {
try {
MarcaProductoParameterReturnGeneral marcaproductoReturnGeneral=new MarcaProductoParameterReturnGeneral();
MarcaProductoLogicAdditional.procesarAccions(parametroGeneralUsuario,modulo,opcion,usuario,this,sProceso,marcaproductos,marcaproductoParameterGeneral,marcaproductoReturnGeneral);
return marcaproductoReturnGeneral;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public MarcaProductoParameterReturnGeneral procesarAccionMarcaProductosWithConnection(ParametroGeneralUsuario parametroGeneralUsuario,Modulo modulo,Opcion opcion,Usuario usuario,String sProceso,List<MarcaProducto> marcaproductos,MarcaProductoParameterReturnGeneral marcaproductoParameterGeneral)throws Exception {
try {
this.connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-procesarAccionMarcaProductosWithConnection");connexion.begin();
MarcaProductoParameterReturnGeneral marcaproductoReturnGeneral=new MarcaProductoParameterReturnGeneral();
MarcaProductoLogicAdditional.procesarAccions(parametroGeneralUsuario,modulo,opcion,usuario,this,sProceso,marcaproductos,marcaproductoParameterGeneral,marcaproductoReturnGeneral);
this.connexion.commit();
return marcaproductoReturnGeneral;
} catch(Exception e) {
this.connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
this.connexion.close();
}
}
public MarcaProductoParameterReturnGeneral procesarEventosMarcaProductos(ParametroGeneralUsuario parametroGeneralUsuario,Modulo moduloActual,Opcion opcionActual,Usuario usuarioActual,EventoGlobalTipo eventoGlobalTipo,ControlTipo controlTipo,EventoTipo eventoTipo,EventoSubTipo eventoSubTipo,String sTipo,List<MarcaProducto> marcaproductos,MarcaProducto marcaproducto,MarcaProductoParameterReturnGeneral marcaproductoParameterGeneral,Boolean isEsNuevoMarcaProducto,ArrayList<Classe> clases)throws Exception {
try {
MarcaProductoParameterReturnGeneral marcaproductoReturnGeneral=new MarcaProductoParameterReturnGeneral();
//SI ES PARA FORMULARIO-> NUEVO PREPARAR, RECARGAR POR DEFECTO FORMULARIO (PARA MANEJAR VALORES POR DEFECTO)
if(eventoGlobalTipo.equals(EventoGlobalTipo.FORM_RECARGAR) && controlTipo.equals(ControlTipo.FORM)
&& eventoTipo.equals(EventoTipo.LOAD) && eventoSubTipo.equals(EventoSubTipo.NEW)
&& sTipo.equals("FORM")) {
marcaproductoReturnGeneral.setConRecargarPropiedades(true);
}
MarcaProductoLogicAdditional.procesarEventos(parametroGeneralUsuario,moduloActual,opcionActual,usuarioActual,this,eventoGlobalTipo,controlTipo,eventoTipo,eventoSubTipo,sTipo,marcaproductos,marcaproducto,marcaproductoParameterGeneral,marcaproductoReturnGeneral,isEsNuevoMarcaProducto,clases);
return marcaproductoReturnGeneral;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public MarcaProductoParameterReturnGeneral procesarEventosMarcaProductosWithConnection(ParametroGeneralUsuario parametroGeneralUsuario,Modulo moduloActual,Opcion opcionActual,Usuario usuarioActual,EventoGlobalTipo eventoGlobalTipo,ControlTipo controlTipo,EventoTipo eventoTipo,EventoSubTipo eventoSubTipo,String sTipo,List<MarcaProducto> marcaproductos,MarcaProducto marcaproducto,MarcaProductoParameterReturnGeneral marcaproductoParameterGeneral,Boolean isEsNuevoMarcaProducto,ArrayList<Classe> clases)throws Exception {
try {
this.connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-procesarEventosMarcaProductosWithConnection");connexion.begin();
MarcaProductoParameterReturnGeneral marcaproductoReturnGeneral=new MarcaProductoParameterReturnGeneral();
marcaproductoReturnGeneral.setMarcaProducto(marcaproducto);
//SI ES PARA FORMULARIO-> NUEVO PREPARAR, RECARGAR POR DEFECTO FORMULARIO (PARA MANEJAR VALORES POR DEFECTO)
if(eventoGlobalTipo.equals(EventoGlobalTipo.FORM_RECARGAR) && controlTipo.equals(ControlTipo.FORM)
&& eventoTipo.equals(EventoTipo.LOAD) && eventoSubTipo.equals(EventoSubTipo.NEW)
&& sTipo.equals("FORM")) {
marcaproductoReturnGeneral.setConRecargarPropiedades(true);
}
MarcaProductoLogicAdditional.procesarEventos(parametroGeneralUsuario,moduloActual,opcionActual,usuarioActual,this,eventoGlobalTipo,controlTipo,eventoTipo,eventoSubTipo,sTipo,marcaproductos,marcaproducto,marcaproductoParameterGeneral,marcaproductoReturnGeneral,isEsNuevoMarcaProducto,clases);
this.connexion.commit();
return marcaproductoReturnGeneral;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
this.connexion.close();
}
}
public MarcaProductoParameterReturnGeneral procesarImportacionMarcaProductosWithConnection(ParametroGeneralUsuario parametroGeneralUsuario,Modulo modulo,Opcion opcion,Usuario usuario,List<DatoGeneralMinimo> datoGeneralMinimos,MarcaProductoParameterReturnGeneral marcaproductoParameterGeneral)throws Exception {
try {
this.connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-procesarImportacionMarcaProductosWithConnection");connexion.begin();
MarcaProductoParameterReturnGeneral marcaproductoReturnGeneral=new MarcaProductoParameterReturnGeneral();
Boolean esPrimero=true;
Boolean conColumnasBase=true;//SIEMPRE
String sDelimiter=Funciones2.getTipoDelimiter(parametroGeneralUsuario);
String sLinea="";
String[] arrColumnas=null;//new String[5];
Integer iColumn=0;
this.marcaproductos=new ArrayList<MarcaProducto>();
for(DatoGeneralMinimo datoGeneralMinimo:datoGeneralMinimos) {
iColumn=0;
if(esPrimero && parametroGeneralUsuario.getcon_exportar_cabecera()) {
esPrimero=false;
continue;
}
sLinea=datoGeneralMinimo.getsDescripcion();
arrColumnas=sLinea.split(sDelimiter);
this.marcaproducto=new MarcaProducto();
if(conColumnasBase) {this.marcaproducto.setId(Long.parseLong(arrColumnas[iColumn++]));}
if(parametroGeneralUsuario.getcon_exportar_campo_version()){
this.marcaproducto.setVersionRow(Timestamp.valueOf(arrColumnas[iColumn++]));
}
this.marcaproducto.setcodigo(arrColumnas[iColumn++]);
this.marcaproducto.setnombre(arrColumnas[iColumn++]);
this.marcaproductos.add(this.marcaproducto);
}
this.saveMarcaProductos();
this.connexion.commit();
marcaproductoReturnGeneral.setConRetornoEstaProcesado(true);
marcaproductoReturnGeneral.setsMensajeProceso("IMPORTADO CORRECTAMENTE");
return marcaproductoReturnGeneral;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
this.connexion.close();
}
}
public void quitarMarcaProductosEliminados() throws Exception {
List<MarcaProducto> marcaproductosAux= new ArrayList<MarcaProducto>();
for(MarcaProducto marcaproducto:marcaproductos) {
if(!marcaproducto.getIsDeleted()) {
marcaproductosAux.add(marcaproducto);
}
}
marcaproductos=marcaproductosAux;
}
public void quitarMarcaProductosNulos() throws Exception {
List<MarcaProducto> marcaproductosAux= new ArrayList<MarcaProducto>();
for(MarcaProducto marcaproducto : this.marcaproductos) {
if(marcaproducto==null) {
marcaproductosAux.add(marcaproducto);
}
}
//this.marcaproductos=marcaproductosAux;
this.marcaproductos.removeAll(marcaproductosAux);
}
public void getSetVersionRowMarcaProductoWithConnection()throws Exception {
//VERIFICA EL OBJETO NO IMPORTA ESTADO
if(marcaproducto.getIsChangedAuxiliar() && Constantes.ISSETVERSIONROWUPDATE) {
//TEMPORAL
//if((marcaproducto.getIsDeleted() || (marcaproducto.getIsChanged()&&!marcaproducto.getIsNew()))&& Constantes.ISSETVERSIONROWUPDATE) {
Timestamp timestamp=null;
try {
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory);connexion.begin();
timestamp=marcaproductoDataAccess.getSetVersionRowMarcaProducto(connexion,marcaproducto.getId());
if(!marcaproducto.getVersionRow().equals(timestamp)) {
marcaproducto.setVersionRow(timestamp);
}
connexion.commit();
marcaproducto.setIsChangedAuxiliar(false);
} catch(Exception e) {
connexion.rollback();
throw e;
} finally {
connexion.close();
}
}
}
private void getSetVersionRowMarcaProducto()throws Exception {
if(marcaproducto.getIsChangedAuxiliar() && Constantes.ISSETVERSIONROWUPDATE) {
//TEMPORAL
//if((marcaproducto.getIsDeleted() || (marcaproducto.getIsChanged()&&!marcaproducto.getIsNew()))&& Constantes.ISSETVERSIONROWUPDATE) {
Timestamp timestamp=marcaproductoDataAccess.getSetVersionRowMarcaProducto(connexion,marcaproducto.getId());
try {
if(!marcaproducto.getVersionRow().equals(timestamp)) {
marcaproducto.setVersionRow(timestamp);
}
marcaproducto.setIsChangedAuxiliar(false);
} catch(Exception e) {
throw e;
} finally {
;
}
}
}
public void getSetVersionRowMarcaProductosWithConnection()throws Exception {
if(marcaproductos!=null && Constantes.ISSETVERSIONROWUPDATE) {
try {
Timestamp timestamp=null;
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory);connexion.begin();
for(MarcaProducto marcaproductoAux:marcaproductos) {
//VERIFICA EL OBJETO NO IMPORTA ESTADO
//if(marcaproductoAux.getIsChangedAuxiliar()) {
//TEMPORAL
//if(marcaproductoAux.getIsDeleted() || (marcaproductoAux.getIsChanged()&&!marcaproductoAux.getIsNew())) {
timestamp=marcaproductoDataAccess.getSetVersionRowMarcaProducto(connexion,marcaproductoAux.getId());
if(!marcaproducto.getVersionRow().equals(timestamp)) {
marcaproductoAux.setVersionRow(timestamp);
}
marcaproductoAux.setIsChangedAuxiliar(false);
//}
}
connexion.commit();
} catch(Exception e) {
connexion.rollback();
throw e;
} finally {
connexion.close();
}
}
}
private void getSetVersionRowMarcaProductos()throws Exception {
if(marcaproductos!=null && Constantes.ISSETVERSIONROWUPDATE) {
try {
Timestamp timestamp=null;
for(MarcaProducto marcaproductoAux:marcaproductos) {
if(marcaproductoAux.getIsChangedAuxiliar()) {
//TEMPORAL
//if(marcaproductoAux.getIsDeleted() || (marcaproductoAux.getIsChanged()&&!marcaproductoAux.getIsNew())) {
timestamp=marcaproductoDataAccess.getSetVersionRowMarcaProducto(connexion,marcaproductoAux.getId());
if(!marcaproductoAux.getVersionRow().equals(timestamp)) {
marcaproductoAux.setVersionRow(timestamp);
}
marcaproductoAux.setIsChangedAuxiliar(false);
}
}
} catch(Exception e) {
throw e;
} finally {
;
}
}
}
public MarcaProductoParameterReturnGeneral cargarCombosLoteForeignKeyMarcaProductoWithConnection(String finalQueryGlobalEmpresa,String finalQueryGlobalTipoProducto) throws Exception {
MarcaProductoParameterReturnGeneral marcaproductoReturnGeneral =new MarcaProductoParameterReturnGeneral();
ArrayList<Classe> clases=new ArrayList<Classe>();
ArrayList<String> arrClasses=new ArrayList<String>();
Classe classe=new Classe();
DatosDeep datosDeep=new DatosDeep(false,DeepLoadType.INCLUDE,clases,"");
try {
this.connexion=this.connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-cargarCombosLoteForeignKeyMarcaProductoWithConnection");connexion.begin();
marcaproductoReturnGeneral =new MarcaProductoParameterReturnGeneral();
List<Empresa> empresasForeignKey=new ArrayList<Empresa>();
EmpresaLogic empresaLogic=new EmpresaLogic();
empresaLogic.setConnexion(this.connexion);
//empresaLogic.getEmpresaDataAccess().setIsForForeingKeyData(true);
if(!finalQueryGlobalEmpresa.equals("NONE")) {
empresaLogic.getTodosEmpresas(finalQueryGlobalEmpresa,new Pagination());
empresasForeignKey=empresaLogic.getEmpresas();
}
marcaproductoReturnGeneral.setempresasForeignKey(empresasForeignKey);
List<TipoProducto> tipoproductosForeignKey=new ArrayList<TipoProducto>();
TipoProductoLogic tipoproductoLogic=new TipoProductoLogic();
tipoproductoLogic.setConnexion(this.connexion);
tipoproductoLogic.getTipoProductoDataAccess().setIsForForeingKeyData(true);
if(!finalQueryGlobalTipoProducto.equals("NONE")) {
tipoproductoLogic.getTodosTipoProductos(finalQueryGlobalTipoProducto,new Pagination());
tipoproductosForeignKey=tipoproductoLogic.getTipoProductos();
}
marcaproductoReturnGeneral.settipoproductosForeignKey(tipoproductosForeignKey);
this.connexion.commit();
} catch(Exception e) {
this.connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
this.connexion.close();
}
return marcaproductoReturnGeneral;
}
public MarcaProductoParameterReturnGeneral cargarCombosLoteForeignKeyMarcaProducto(String finalQueryGlobalEmpresa,String finalQueryGlobalTipoProducto) throws Exception {
MarcaProductoParameterReturnGeneral marcaproductoReturnGeneral =new MarcaProductoParameterReturnGeneral();
ArrayList<Classe> clases=new ArrayList<Classe>();
ArrayList<String> arrClasses=new ArrayList<String>();
Classe classe=new Classe();
DatosDeep datosDeep=new DatosDeep(false,DeepLoadType.INCLUDE,clases,"");
try {
marcaproductoReturnGeneral =new MarcaProductoParameterReturnGeneral();
List<Empresa> empresasForeignKey=new ArrayList<Empresa>();
EmpresaLogic empresaLogic=new EmpresaLogic();
empresaLogic.setConnexion(this.connexion);
//empresaLogic.getEmpresaDataAccess().setIsForForeingKeyData(true);
if(!finalQueryGlobalEmpresa.equals("NONE")) {
empresaLogic.getTodosEmpresas(finalQueryGlobalEmpresa,new Pagination());
empresasForeignKey=empresaLogic.getEmpresas();
}
marcaproductoReturnGeneral.setempresasForeignKey(empresasForeignKey);
List<TipoProducto> tipoproductosForeignKey=new ArrayList<TipoProducto>();
TipoProductoLogic tipoproductoLogic=new TipoProductoLogic();
tipoproductoLogic.setConnexion(this.connexion);
tipoproductoLogic.getTipoProductoDataAccess().setIsForForeingKeyData(true);
if(!finalQueryGlobalTipoProducto.equals("NONE")) {
tipoproductoLogic.getTodosTipoProductos(finalQueryGlobalTipoProducto,new Pagination());
tipoproductosForeignKey=tipoproductoLogic.getTipoProductos();
}
marcaproductoReturnGeneral.settipoproductosForeignKey(tipoproductosForeignKey);
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
}
return marcaproductoReturnGeneral;
}
public void cargarRelacionesLoteForeignKeyMarcaProductoWithConnection() throws Exception {
ArrayList<Classe> classes=new ArrayList<Classe>();
ProductoLogic productoLogic=new ProductoLogic();
ParametroInventarioDefectoLogic parametroinventariodefectoLogic=new ParametroInventarioDefectoLogic();
try {
this.connexion=this.connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-cargarRelacionesLoteForeignKeyMarcaProductoWithConnection");connexion.begin();
classes.add(new Classe(Producto.class));
classes.add(new Classe(ParametroInventarioDefecto.class));
productoLogic.setConnexion(this.getConnexion());
productoLogic.setDatosCliente(this.datosCliente);
productoLogic.setIsConRefrescarForeignKeys(true);
parametroinventariodefectoLogic.setConnexion(this.getConnexion());
parametroinventariodefectoLogic.setDatosCliente(this.datosCliente);
parametroinventariodefectoLogic.setIsConRefrescarForeignKeys(true);
this.deepLoads(false, DeepLoadType.INCLUDE, classes, "");
for(MarcaProducto marcaproducto:this.marcaproductos) {
classes=new ArrayList<Classe>();
classes=ProductoConstantesFunciones.getClassesForeignKeysOfProducto(new ArrayList<Classe>(),DeepLoadType.NONE);
productoLogic.setProductos(marcaproducto.productos);
productoLogic.deepLoads(false, DeepLoadType.INCLUDE, classes, "");
classes=new ArrayList<Classe>();
classes=ParametroInventarioDefectoConstantesFunciones.getClassesForeignKeysOfParametroInventarioDefecto(new ArrayList<Classe>(),DeepLoadType.NONE);
parametroinventariodefectoLogic.setParametroInventarioDefectos(marcaproducto.parametroinventariodefectos);
parametroinventariodefectoLogic.deepLoads(false, DeepLoadType.INCLUDE, classes, "");
}
this.connexion.commit();
} catch(Exception e) {
this.connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
this.connexion.close();
}
}
public void deepLoad(MarcaProducto marcaproducto,Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases)throws Exception {
Boolean existe=false;
try {
MarcaProductoLogicAdditional.updateMarcaProductoToGet(marcaproducto,this.arrDatoGeneral);
if(!isDeep) {
if(deepLoadType.equals(DeepLoadType.NONE)) {
marcaproducto.setEmpresa(marcaproductoDataAccess.getEmpresa(connexion,marcaproducto));
marcaproducto.setTipoProducto(marcaproductoDataAccess.getTipoProducto(connexion,marcaproducto));
marcaproducto.setProductos(marcaproductoDataAccess.getProductos(connexion,marcaproducto));
marcaproducto.setParametroInventarioDefectos(marcaproductoDataAccess.getParametroInventarioDefectos(connexion,marcaproducto));
}
else if(deepLoadType.equals(DeepLoadType.INCLUDE)) {
for(Classe clas:clases) {
if(clas.clas.equals(Empresa.class)) {
marcaproducto.setEmpresa(marcaproductoDataAccess.getEmpresa(connexion,marcaproducto));
continue;
}
if(clas.clas.equals(TipoProducto.class)) {
marcaproducto.setTipoProducto(marcaproductoDataAccess.getTipoProducto(connexion,marcaproducto));
continue;
}
if(clas.clas.equals(Producto.class)&&clas.blnActivo) {
clas.blnActivo=false;
marcaproducto.setProductos(marcaproductoDataAccess.getProductos(connexion,marcaproducto));
if(this.isConDeep) {
ProductoLogic productoLogic= new ProductoLogic(this.connexion);
productoLogic.setProductos(marcaproducto.getProductos());
ArrayList<Classe> classesLocal=ProductoConstantesFunciones.getClassesForeignKeysOfProducto(new ArrayList<Classe>(),DeepLoadType.NONE);
productoLogic.deepLoads(false,DeepLoadType.INCLUDE, classesLocal,"");
ProductoConstantesFunciones.refrescarForeignKeysDescripcionesProducto(productoLogic.getProductos());
marcaproducto.setProductos(productoLogic.getProductos());
}
continue;
}
if(clas.clas.equals(ParametroInventarioDefecto.class)&&clas.blnActivo) {
clas.blnActivo=false;
marcaproducto.setParametroInventarioDefectos(marcaproductoDataAccess.getParametroInventarioDefectos(connexion,marcaproducto));
if(this.isConDeep) {
ParametroInventarioDefectoLogic parametroinventariodefectoLogic= new ParametroInventarioDefectoLogic(this.connexion);
parametroinventariodefectoLogic.setParametroInventarioDefectos(marcaproducto.getParametroInventarioDefectos());
ArrayList<Classe> classesLocal=ParametroInventarioDefectoConstantesFunciones.getClassesForeignKeysOfParametroInventarioDefecto(new ArrayList<Classe>(),DeepLoadType.NONE);
parametroinventariodefectoLogic.deepLoads(false,DeepLoadType.INCLUDE, classesLocal,"");
ParametroInventarioDefectoConstantesFunciones.refrescarForeignKeysDescripcionesParametroInventarioDefecto(parametroinventariodefectoLogic.getParametroInventarioDefectos());
marcaproducto.setParametroInventarioDefectos(parametroinventariodefectoLogic.getParametroInventarioDefectos());
}
continue;
}
}
}
else if(deepLoadType.equals(DeepLoadType.EXCLUDE)) {
existe=false;
for(Classe clas:clases) {
if(clas.clas.equals(Empresa.class)) {
existe=true;
break;
}
}
if(!existe) {
marcaproducto.setEmpresa(marcaproductoDataAccess.getEmpresa(connexion,marcaproducto));
}
existe=false;
for(Classe clas:clases) {
if(clas.clas.equals(TipoProducto.class)) {
existe=true;
break;
}
}
if(!existe) {
marcaproducto.setTipoProducto(marcaproductoDataAccess.getTipoProducto(connexion,marcaproducto));
}
existe=false;
for(Classe clas:clases) {
if(clas.clas.equals(Producto.class)&&clas.blnActivo) {
clas.blnActivo=false;
existe=true;
break;
}
}
if(!existe) {
clases.add(new Classe(Producto.class));
marcaproducto.setProductos(marcaproductoDataAccess.getProductos(connexion,marcaproducto));
}
existe=false;
for(Classe clas:clases) {
if(clas.clas.equals(ParametroInventarioDefecto.class)&&clas.blnActivo) {
clas.blnActivo=false;
existe=true;
break;
}
}
if(!existe) {
clases.add(new Classe(ParametroInventarioDefecto.class));
marcaproducto.setParametroInventarioDefectos(marcaproductoDataAccess.getParametroInventarioDefectos(connexion,marcaproducto));
}
}
}
else {
if(deepLoadType.equals(DeepLoadType.NONE)) {
marcaproducto.setEmpresa(marcaproductoDataAccess.getEmpresa(connexion,marcaproducto));
EmpresaLogic empresaLogic= new EmpresaLogic(connexion);
empresaLogic.deepLoad(marcaproducto.getEmpresa(),isDeep,deepLoadType,clases);
marcaproducto.setTipoProducto(marcaproductoDataAccess.getTipoProducto(connexion,marcaproducto));
TipoProductoLogic tipoproductoLogic= new TipoProductoLogic(connexion);
tipoproductoLogic.deepLoad(marcaproducto.getTipoProducto(),isDeep,deepLoadType,clases);
marcaproducto.setProductos(marcaproductoDataAccess.getProductos(connexion,marcaproducto));
for(Producto producto:marcaproducto.getProductos()) {
ProductoLogic productoLogic= new ProductoLogic(connexion);
productoLogic.deepLoad(producto,isDeep,deepLoadType,clases);
}
marcaproducto.setParametroInventarioDefectos(marcaproductoDataAccess.getParametroInventarioDefectos(connexion,marcaproducto));
for(ParametroInventarioDefecto parametroinventariodefecto:marcaproducto.getParametroInventarioDefectos()) {
ParametroInventarioDefectoLogic parametroinventariodefectoLogic= new ParametroInventarioDefectoLogic(connexion);
parametroinventariodefectoLogic.deepLoad(parametroinventariodefecto,isDeep,deepLoadType,clases);
}
}
else if(deepLoadType.equals(DeepLoadType.INCLUDE)) {
for(Classe clas:clases) {
if(clas.clas.equals(Empresa.class)) {
marcaproducto.setEmpresa(marcaproductoDataAccess.getEmpresa(connexion,marcaproducto));
EmpresaLogic empresaLogic= new EmpresaLogic(connexion);
empresaLogic.deepLoad(marcaproducto.getEmpresa(),isDeep,deepLoadType,clases);
continue;
}
if(clas.clas.equals(TipoProducto.class)) {
marcaproducto.setTipoProducto(marcaproductoDataAccess.getTipoProducto(connexion,marcaproducto));
TipoProductoLogic tipoproductoLogic= new TipoProductoLogic(connexion);
tipoproductoLogic.deepLoad(marcaproducto.getTipoProducto(),isDeep,deepLoadType,clases);
continue;
}
if(clas.clas.equals(Producto.class)&&clas.blnActivo) {
clas.blnActivo=false;
marcaproducto.setProductos(marcaproductoDataAccess.getProductos(connexion,marcaproducto));
for(Producto producto:marcaproducto.getProductos()) {
ProductoLogic productoLogic= new ProductoLogic(connexion);
productoLogic.deepLoad(producto,isDeep,deepLoadType,clases);
}
continue;
}
if(clas.clas.equals(ParametroInventarioDefecto.class)&&clas.blnActivo) {
clas.blnActivo=false;
marcaproducto.setParametroInventarioDefectos(marcaproductoDataAccess.getParametroInventarioDefectos(connexion,marcaproducto));
for(ParametroInventarioDefecto parametroinventariodefecto:marcaproducto.getParametroInventarioDefectos()) {
ParametroInventarioDefectoLogic parametroinventariodefectoLogic= new ParametroInventarioDefectoLogic(connexion);
parametroinventariodefectoLogic.deepLoad(parametroinventariodefecto,isDeep,deepLoadType,clases);
}
continue;
}
}
}
else if(deepLoadType.equals(DeepLoadType.EXCLUDE)) {
existe=false;
for(Classe clas:clases) {
if(clas.clas.equals(Empresa.class)) {
existe=true;
break;
}
}
if(!existe) {
marcaproducto.setEmpresa(marcaproductoDataAccess.getEmpresa(connexion,marcaproducto));
EmpresaLogic empresaLogic= new EmpresaLogic(connexion);
empresaLogic.deepLoad(marcaproducto.getEmpresa(),isDeep,deepLoadType,clases);
}
existe=false;
for(Classe clas:clases) {
if(clas.clas.equals(TipoProducto.class)) {
existe=true;
break;
}
}
if(!existe) {
marcaproducto.setTipoProducto(marcaproductoDataAccess.getTipoProducto(connexion,marcaproducto));
TipoProductoLogic tipoproductoLogic= new TipoProductoLogic(connexion);
tipoproductoLogic.deepLoad(marcaproducto.getTipoProducto(),isDeep,deepLoadType,clases);
}
existe=false;
for(Classe clas:clases) {
if(clas.clas.equals(Producto.class)&&clas.blnActivo) {
clas.blnActivo=false;
existe=true;
break;
}
}
if(!existe) {
clases.add(new Classe(Producto.class));
marcaproducto.setProductos(marcaproductoDataAccess.getProductos(connexion,marcaproducto));
for(Producto producto:marcaproducto.getProductos()) {
ProductoLogic productoLogic= new ProductoLogic(connexion);
productoLogic.deepLoad(producto,isDeep,deepLoadType,clases);
}
}
existe=false;
for(Classe clas:clases) {
if(clas.clas.equals(ParametroInventarioDefecto.class)&&clas.blnActivo) {
clas.blnActivo=false;
existe=true;
break;
}
}
if(!existe) {
clases.add(new Classe(ParametroInventarioDefecto.class));
marcaproducto.setParametroInventarioDefectos(marcaproductoDataAccess.getParametroInventarioDefectos(connexion,marcaproducto));
for(ParametroInventarioDefecto parametroinventariodefecto:marcaproducto.getParametroInventarioDefectos()) {
ParametroInventarioDefectoLogic parametroinventariodefectoLogic= new ParametroInventarioDefectoLogic(connexion);
parametroinventariodefectoLogic.deepLoad(parametroinventariodefecto,isDeep,deepLoadType,clases);
}
}
}
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public void deepSave(MarcaProducto marcaproducto,Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases)throws Exception {
Boolean existe=false;
try {
MarcaProductoLogicAdditional.updateMarcaProductoToSave(marcaproducto,this.arrDatoGeneral);
MarcaProductoDataAccess.save(marcaproducto, connexion);
if(!isDeep) {
if(deepLoadType.equals(DeepLoadType.NONE)) {
EmpresaDataAccess.save(marcaproducto.getEmpresa(),connexion);
TipoProductoDataAccess.save(marcaproducto.getTipoProducto(),connexion);
for(Producto producto:marcaproducto.getProductos()) {
producto.setid_marca_producto(marcaproducto.getId());
ProductoDataAccess.save(producto,connexion);
}
for(ParametroInventarioDefecto parametroinventariodefecto:marcaproducto.getParametroInventarioDefectos()) {
parametroinventariodefecto.setid_marca_producto(marcaproducto.getId());
ParametroInventarioDefectoDataAccess.save(parametroinventariodefecto,connexion);
}
}
else if(deepLoadType.equals(DeepLoadType.INCLUDE)) {
for(Classe clas:clases) {
if(clas.clas.equals(Empresa.class)) {
EmpresaDataAccess.save(marcaproducto.getEmpresa(),connexion);
continue;
}
if(clas.clas.equals(TipoProducto.class)) {
TipoProductoDataAccess.save(marcaproducto.getTipoProducto(),connexion);
continue;
}
if(clas.clas.equals(Producto.class)&&clas.blnActivo) {
clas.blnActivo=false;
for(Producto producto:marcaproducto.getProductos()) {
producto.setid_marca_producto(marcaproducto.getId());
ProductoDataAccess.save(producto,connexion);
}
continue;
}
if(clas.clas.equals(ParametroInventarioDefecto.class)&&clas.blnActivo) {
clas.blnActivo=false;
for(ParametroInventarioDefecto parametroinventariodefecto:marcaproducto.getParametroInventarioDefectos()) {
parametroinventariodefecto.setid_marca_producto(marcaproducto.getId());
ParametroInventarioDefectoDataAccess.save(parametroinventariodefecto,connexion);
}
continue;
}
}
}
}
else {
if(deepLoadType.equals(DeepLoadType.NONE)) {
EmpresaDataAccess.save(marcaproducto.getEmpresa(),connexion);
EmpresaLogic empresaLogic= new EmpresaLogic(connexion);
empresaLogic.deepLoad(marcaproducto.getEmpresa(),isDeep,deepLoadType,clases);
TipoProductoDataAccess.save(marcaproducto.getTipoProducto(),connexion);
TipoProductoLogic tipoproductoLogic= new TipoProductoLogic(connexion);
tipoproductoLogic.deepLoad(marcaproducto.getTipoProducto(),isDeep,deepLoadType,clases);
for(Producto producto:marcaproducto.getProductos()) {
ProductoLogic productoLogic= new ProductoLogic(connexion);
producto.setid_marca_producto(marcaproducto.getId());
ProductoDataAccess.save(producto,connexion);
productoLogic.deepSave(producto,isDeep,deepLoadType,clases);
}
for(ParametroInventarioDefecto parametroinventariodefecto:marcaproducto.getParametroInventarioDefectos()) {
ParametroInventarioDefectoLogic parametroinventariodefectoLogic= new ParametroInventarioDefectoLogic(connexion);
parametroinventariodefecto.setid_marca_producto(marcaproducto.getId());
ParametroInventarioDefectoDataAccess.save(parametroinventariodefecto,connexion);
parametroinventariodefectoLogic.deepSave(parametroinventariodefecto,isDeep,deepLoadType,clases);
}
}
else if(deepLoadType.equals(DeepLoadType.INCLUDE)) {
for(Classe clas:clases) {
if(clas.clas.equals(Empresa.class)) {
EmpresaDataAccess.save(marcaproducto.getEmpresa(),connexion);
EmpresaLogic empresaLogic= new EmpresaLogic(connexion);
empresaLogic.deepSave(marcaproducto.getEmpresa(),isDeep,deepLoadType,clases);
continue;
}
if(clas.clas.equals(TipoProducto.class)) {
TipoProductoDataAccess.save(marcaproducto.getTipoProducto(),connexion);
TipoProductoLogic tipoproductoLogic= new TipoProductoLogic(connexion);
tipoproductoLogic.deepSave(marcaproducto.getTipoProducto(),isDeep,deepLoadType,clases);
continue;
}
if(clas.clas.equals(Producto.class)&&clas.blnActivo) {
clas.blnActivo=false;
for(Producto producto:marcaproducto.getProductos()) {
ProductoLogic productoLogic= new ProductoLogic(connexion);
producto.setid_marca_producto(marcaproducto.getId());
ProductoDataAccess.save(producto,connexion);
productoLogic.deepSave(producto,isDeep,deepLoadType,clases);
}
continue;
}
if(clas.clas.equals(ParametroInventarioDefecto.class)&&clas.blnActivo) {
clas.blnActivo=false;
for(ParametroInventarioDefecto parametroinventariodefecto:marcaproducto.getParametroInventarioDefectos()) {
ParametroInventarioDefectoLogic parametroinventariodefectoLogic= new ParametroInventarioDefectoLogic(connexion);
parametroinventariodefecto.setid_marca_producto(marcaproducto.getId());
ParametroInventarioDefectoDataAccess.save(parametroinventariodefecto,connexion);
parametroinventariodefectoLogic.deepSave(parametroinventariodefecto,isDeep,deepLoadType,clases);
}
continue;
}
}
}
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public void deepLoadWithConnection(Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases,String sTituloMensaje)throws Exception {
try {
this.getNewConnexionToDeep(MarcaProducto.class.getSimpleName()+"-deepLoadWithConnection");
this.deepLoad(marcaproducto,isDeep,deepLoadType,clases);
if(this.isConRefrescarForeignKeys) {
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(marcaproducto);
}
this.connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
this.closeNewConnexionToDeep();
}
}
public void deepLoad(Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases,String sTituloMensaje)throws Exception {
try {
this.deepLoad(this.marcaproducto,isDeep,deepLoadType,clases);
if(this.isConRefrescarForeignKeys) {
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproducto);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public void deepLoadsWithConnection(Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases,String sTituloMensaje)throws Exception {
try {
this.getNewConnexionToDeep(MarcaProducto.class.getSimpleName()+"-deepLoadsWithConnection");
if(marcaproductos!=null) {
for(MarcaProducto marcaproducto:marcaproductos) {
this.deepLoad(marcaproducto,isDeep,deepLoadType,clases);
}
if(this.isConRefrescarForeignKeys) {
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(marcaproductos);
}
}
this.connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
this.closeNewConnexionToDeep();
}
}
public void deepLoads(Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases,String sTituloMensaje)throws Exception {
try {
if(marcaproductos!=null) {
for(MarcaProducto marcaproducto:marcaproductos) {
this.deepLoad(marcaproducto,isDeep,deepLoadType,clases);
}
if(this.isConRefrescarForeignKeys) {
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(marcaproductos);
}
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void deepSaveWithConnection(Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases,String sTituloMensaje)throws Exception {
try {
this.getNewConnexionToDeep(MarcaProducto.class.getSimpleName()+"-deepSaveWithConnection");
this.deepSave(marcaproducto,isDeep,deepLoadType,clases);
this.connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
} finally {
this.closeNewConnexionToDeep();
}
}
public void deepSavesWithConnection(Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases,String sTituloMensaje)throws Exception {
try {
this.getNewConnexionToDeep(MarcaProducto.class.getSimpleName()+"-deepSavesWithConnection");
if(marcaproductos!=null) {
for(MarcaProducto marcaproducto:marcaproductos) {
this.deepSave(marcaproducto,isDeep,deepLoadType,clases);
}
}
this.connexion.commit();
} catch(Exception e) {
connexion.rollback();
Funciones.manageException(logger,e);
throw e;
}finally {
this.closeNewConnexionToDeep();
}
}
public void deepSaves(Boolean isDeep,DeepLoadType deepLoadType,ArrayList<Classe> clases,String sTituloMensaje)throws Exception {
try {
if(marcaproductos!=null) {
for(MarcaProducto marcaproducto:marcaproductos) {
this.deepSave(marcaproducto,isDeep,deepLoadType,clases);
}
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
;
}
}
public void getMarcaProductosBusquedaPorCodigoWithConnection(String sFinalQuery,Pagination pagination,String codigo)throws Exception {
try
{
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getBusquedaIndice");connexion.begin();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters(ParameterDbType.MYSQL,"");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
ParameterSelectionGeneral parameterSelectionGeneralCodigo= new ParameterSelectionGeneral();
parameterSelectionGeneralCodigo.setParameterSelectionGeneralLike(ParameterType.STRING,"%"+codigo+"%",MarcaProductoConstantesFunciones.CODIGO,ParameterTypeOperator.NONE);
queryWhereSelectParameters.addParameter(parameterSelectionGeneralCodigo);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"BusquedaPorCodigo","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
connexion.commit();
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getMarcaProductosBusquedaPorCodigo(String sFinalQuery,Pagination pagination,String codigo)throws Exception {
try
{
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters(ParameterDbType.MYSQL,"");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
ParameterSelectionGeneral parameterSelectionGeneralCodigo= new ParameterSelectionGeneral();
parameterSelectionGeneralCodigo.setParameterSelectionGeneralLike(ParameterType.STRING,"%"+codigo+"%",MarcaProductoConstantesFunciones.CODIGO,ParameterTypeOperator.NONE);
queryWhereSelectParameters.addParameter(parameterSelectionGeneralCodigo);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"BusquedaPorCodigo","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
}
}
public void getMarcaProductosBusquedaPorNombreWithConnection(String sFinalQuery,Pagination pagination,String nombre)throws Exception {
try
{
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getBusquedaIndice");connexion.begin();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters(ParameterDbType.MYSQL,"");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
ParameterSelectionGeneral parameterSelectionGeneralNombre= new ParameterSelectionGeneral();
parameterSelectionGeneralNombre.setParameterSelectionGeneralLike(ParameterType.STRING,"%"+nombre+"%",MarcaProductoConstantesFunciones.NOMBRE,ParameterTypeOperator.NONE);
queryWhereSelectParameters.addParameter(parameterSelectionGeneralNombre);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"BusquedaPorNombre","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
connexion.commit();
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getMarcaProductosBusquedaPorNombre(String sFinalQuery,Pagination pagination,String nombre)throws Exception {
try
{
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters(ParameterDbType.MYSQL,"");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
ParameterSelectionGeneral parameterSelectionGeneralNombre= new ParameterSelectionGeneral();
parameterSelectionGeneralNombre.setParameterSelectionGeneralLike(ParameterType.STRING,"%"+nombre+"%",MarcaProductoConstantesFunciones.NOMBRE,ParameterTypeOperator.NONE);
queryWhereSelectParameters.addParameter(parameterSelectionGeneralNombre);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"BusquedaPorNombre","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
}
}
public void getMarcaProductosFK_IdEmpresaWithConnection(String sFinalQuery,Pagination pagination,Long id_empresa)throws Exception {
try
{
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getBusquedaIndice");connexion.begin();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters(ParameterDbType.MYSQL,"");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
ParameterSelectionGeneral parameterSelectionGeneralidEmpresa= new ParameterSelectionGeneral();
parameterSelectionGeneralidEmpresa.setParameterSelectionGeneralEqual(ParameterType.LONG,id_empresa,MarcaProductoConstantesFunciones.IDEMPRESA,ParameterTypeOperator.NONE);
queryWhereSelectParameters.addParameter(parameterSelectionGeneralidEmpresa);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"FK_IdEmpresa","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
connexion.commit();
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getMarcaProductosFK_IdEmpresa(String sFinalQuery,Pagination pagination,Long id_empresa)throws Exception {
try
{
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters(ParameterDbType.MYSQL,"");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
ParameterSelectionGeneral parameterSelectionGeneralidEmpresa= new ParameterSelectionGeneral();
parameterSelectionGeneralidEmpresa.setParameterSelectionGeneralEqual(ParameterType.LONG,id_empresa,MarcaProductoConstantesFunciones.IDEMPRESA,ParameterTypeOperator.NONE);
queryWhereSelectParameters.addParameter(parameterSelectionGeneralidEmpresa);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"FK_IdEmpresa","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
}
}
public void getMarcaProductosFK_IdTipoProductoWithConnection(String sFinalQuery,Pagination pagination,Long id_tipo_producto)throws Exception {
try
{
connexion=connexion.getNewConnexion(this.connexionType,this.parameterDbType,this.entityManagerFactory,MarcaProducto.class.getSimpleName()+"-getBusquedaIndice");connexion.begin();
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters(ParameterDbType.MYSQL,"");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
ParameterSelectionGeneral parameterSelectionGeneralidTipoProducto= new ParameterSelectionGeneral();
parameterSelectionGeneralidTipoProducto.setParameterSelectionGeneralEqual(ParameterType.LONG,id_tipo_producto,MarcaProductoConstantesFunciones.IDTIPOPRODUCTO,ParameterTypeOperator.NONE);
queryWhereSelectParameters.addParameter(parameterSelectionGeneralidTipoProducto);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"FK_IdTipoProducto","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
connexion.commit();
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
connexion.close();
}
}
public void getMarcaProductosFK_IdTipoProducto(String sFinalQuery,Pagination pagination,Long id_tipo_producto)throws Exception {
try
{
QueryWhereSelectParameters queryWhereSelectParameters=new QueryWhereSelectParameters(ParameterDbType.MYSQL,"");
queryWhereSelectParameters.setPagination(pagination);
queryWhereSelectParameters.setFinalQuery(sFinalQuery);
ParameterSelectionGeneral parameterSelectionGeneralidTipoProducto= new ParameterSelectionGeneral();
parameterSelectionGeneralidTipoProducto.setParameterSelectionGeneralEqual(ParameterType.LONG,id_tipo_producto,MarcaProductoConstantesFunciones.IDTIPOPRODUCTO,ParameterTypeOperator.NONE);
queryWhereSelectParameters.addParameter(parameterSelectionGeneralidTipoProducto);
MarcaProductoLogic.registrarAuditoria(this.connexion,datosCliente.getIdUsuario(),"FK_IdTipoProducto","",queryWhereSelectParameters,datosCliente.getsUsuarioPC(),datosCliente.getsNamePC(),datosCliente.getsIPPC());
marcaproductos=marcaproductoDataAccess.getEntities(connexion,queryWhereSelectParameters);
if(this.isConDeep) {
this.deepLoads(this.datosDeep.getIsDeep(),this.datosDeep.getDeepLoadType(), this.datosDeep.getClases(),this.datosDeep.getSTituloMensaje());
MarcaProductoConstantesFunciones.refrescarForeignKeysDescripcionesMarcaProducto(this.marcaproductos);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
} finally {
}
}
public static void registrarAuditoria(Connexion connexion,Long idUsuario,String sProcesoBusqueda,String sDetalleProcesoBusqueda,QueryWhereSelectParameters queryWhereSelectParameters,String sUsuarioPC,String sNamePC,String sIPPC)throws Exception {
////AuditoriaLogicAdditional auditoriaLogicAdditional=new AuditoriaLogicAdditional();
////auditoriaLogicAdditional.setConnexion(connexion);
////AuditoriaDataAccess.SCHEMA="bydan_erp";
try {
if(MarcaProductoConstantesFunciones.ISCONAUDITORIA) {
String sDetalleBusqueda=sDetalleProcesoBusqueda+Funciones.getDetalleBusqueda(queryWhereSelectParameters);
////auditoriaLogicAdditional.registrarNuevaAuditoriaBusqueda(Constantes.LIDSISTEMAACTUAL,idUsuario,MarcaProductoDataAccess.TABLENAME, 0L, Constantes.SAUDITORIABUSCAR,sProcesoBusqueda,sUsuarioPC,sNamePC,sIPPC,new Date(),sDetalleBusqueda);
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public static void registrarAuditoria(Connexion connexion,Long idUsuario,MarcaProducto marcaproducto,String sUsuarioPC,String sNamePC,String sIPPC)throws Exception {
////AuditoriaLogicAdditional auditoriaLogicAdditional=new AuditoriaLogicAdditional();
////auditoriaLogicAdditional.setConnexion(connexion);
////AuditoriaDataAccess.SCHEMA="bydan_erp";
try {
if(MarcaProductoConstantesFunciones.ISCONAUDITORIA) {
if(marcaproducto.getIsNew()) {
////auditoriaLogicAdditional.registrarNuevaAuditoria(Constantes.LIDSISTEMAACTUAL,idUsuario,MarcaProductoDataAccess.TABLENAME, marcaproducto.getId(), Constantes.SAUDITORIAINSERTAR,"",sUsuarioPC,sNamePC,sIPPC,new Date(),"");
if(MarcaProductoConstantesFunciones.ISCONAUDITORIADETALLE) {
////MarcaProductoLogic.registrarAuditoriaDetallesMarcaProducto(connexion,marcaproducto,auditoriaLogicAdditional.getAuditoria());
}
} else if(marcaproducto.getIsDeleted()) {
/*if(!marcaproducto.getIsExpired()) {
////auditoriaLogicAdditional.RegistrarNuevaAuditoria(Constantes.getLOidSistemaActual(),idUsuario,MarcaProductoDataAccess.TABLENAME, marcaproducto.getId(), Constantes.getSAuditoriaEliminarLogicamente(),"",sUsuarioPC,sNamePC,sIPPC,Timestamp.valueOf(Funciones.getStringMySqlCurrentDateTime()),"");
////MarcaProductoLogic.registrarAuditoriaDetallesMarcaProducto(connexion,marcaproducto,auditoriaLogicAdditional.getAuditoria());
} else {*/
////auditoriaLogicAdditional.registrarNuevaAuditoria(Constantes.LIDSISTEMAACTUAL,idUsuario,MarcaProductoDataAccess.TABLENAME, marcaproducto.getId(), Constantes.SAUDITORIAELIMINARFISICAMENTE,"",sUsuarioPC,sNamePC,sIPPC,new Date(),"");
//}
} else if(marcaproducto.getIsChanged()) {
////auditoriaLogicAdditional.registrarNuevaAuditoria(Constantes.LIDSISTEMAACTUAL,idUsuario,MarcaProductoDataAccess.TABLENAME, marcaproducto.getId(), Constantes.SAUDITORIAACTUALIZAR,"",sUsuarioPC,sNamePC,sIPPC,new Date(),"");
if(MarcaProductoConstantesFunciones.ISCONAUDITORIADETALLE) {
////MarcaProductoLogic.registrarAuditoriaDetallesMarcaProducto(connexion,marcaproducto,auditoriaLogicAdditional.getAuditoria());
}
}
}
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
private static void registrarAuditoriaDetallesMarcaProducto(Connexion connexion,MarcaProducto marcaproducto)throws Exception {
////AuditoriaDetalleLogicAdditional auditoriaDetalleLogicAdditional= new AuditoriaDetalleLogicAdditional();
////auditoriaDetalleLogicAdditional.setConnexion(connexion);
////AuditoriaDetalleDataAccess.SCHEMA="bydan_erp";
String strValorActual=null;
String strValorNuevo=null;
if(marcaproducto.getIsNew()||!marcaproducto.getid_empresa().equals(marcaproducto.getMarcaProductoOriginal().getid_empresa()))
{
strValorActual=null;
strValorNuevo=null;
if(marcaproducto.getMarcaProductoOriginal().getid_empresa()!=null)
{
strValorActual=marcaproducto.getMarcaProductoOriginal().getid_empresa().toString();
}
if(marcaproducto.getid_empresa()!=null)
{
strValorNuevo=marcaproducto.getid_empresa().toString() ;
}
////auditoriaDetalleLogicAdditional.registrarNuevaAuditoriaDetalle(auditoriaObj.getId(),MarcaProductoConstantesFunciones.IDEMPRESA,strValorActual,strValorNuevo);
}
if(marcaproducto.getIsNew()||!marcaproducto.getid_tipo_producto().equals(marcaproducto.getMarcaProductoOriginal().getid_tipo_producto()))
{
strValorActual=null;
strValorNuevo=null;
if(marcaproducto.getMarcaProductoOriginal().getid_tipo_producto()!=null)
{
strValorActual=marcaproducto.getMarcaProductoOriginal().getid_tipo_producto().toString();
}
if(marcaproducto.getid_tipo_producto()!=null)
{
strValorNuevo=marcaproducto.getid_tipo_producto().toString() ;
}
////auditoriaDetalleLogicAdditional.registrarNuevaAuditoriaDetalle(auditoriaObj.getId(),MarcaProductoConstantesFunciones.IDTIPOPRODUCTO,strValorActual,strValorNuevo);
}
if(marcaproducto.getIsNew()||!marcaproducto.getcodigo().equals(marcaproducto.getMarcaProductoOriginal().getcodigo()))
{
strValorActual=null;
strValorNuevo=null;
if(marcaproducto.getMarcaProductoOriginal().getcodigo()!=null)
{
strValorActual=marcaproducto.getMarcaProductoOriginal().getcodigo();
}
if(marcaproducto.getcodigo()!=null)
{
strValorNuevo=marcaproducto.getcodigo() ;
}
////auditoriaDetalleLogicAdditional.registrarNuevaAuditoriaDetalle(auditoriaObj.getId(),MarcaProductoConstantesFunciones.CODIGO,strValorActual,strValorNuevo);
}
if(marcaproducto.getIsNew()||!marcaproducto.getnombre().equals(marcaproducto.getMarcaProductoOriginal().getnombre()))
{
strValorActual=null;
strValorNuevo=null;
if(marcaproducto.getMarcaProductoOriginal().getnombre()!=null)
{
strValorActual=marcaproducto.getMarcaProductoOriginal().getnombre();
}
if(marcaproducto.getnombre()!=null)
{
strValorNuevo=marcaproducto.getnombre() ;
}
////auditoriaDetalleLogicAdditional.registrarNuevaAuditoriaDetalle(auditoriaObj.getId(),MarcaProductoConstantesFunciones.NOMBRE,strValorActual,strValorNuevo);
}
}
public void saveMarcaProductoRelacionesWithConnection(MarcaProducto marcaproducto,List<Producto> productos,List<ParametroInventarioDefecto> parametroinventariodefectos) throws Exception {
if(!marcaproducto.getsType().contains(Constantes2.S_TOTALES)) {
this.saveMarcaProductoRelacionesBase(marcaproducto,productos,parametroinventariodefectos,true);
}
}
public void saveMarcaProductoRelaciones(MarcaProducto marcaproducto,List<Producto> productos,List<ParametroInventarioDefecto> parametroinventariodefectos)throws Exception {
if(!marcaproducto.getsType().contains(Constantes2.S_TOTALES)) {
this.saveMarcaProductoRelacionesBase(marcaproducto,productos,parametroinventariodefectos,false);
}
}
public void saveMarcaProductoRelacionesBase(MarcaProducto marcaproducto,List<Producto> productos,List<ParametroInventarioDefecto> parametroinventariodefectos,Boolean conConexion)throws Exception {
try {
if(conConexion) {this.getNewConnexionToDeep("MarcaProducto-saveRelacionesWithConnection");}
marcaproducto.setProductos(productos);
marcaproducto.setParametroInventarioDefectos(parametroinventariodefectos);
this.setMarcaProducto(marcaproducto);
if(MarcaProductoLogicAdditional.validarSaveRelaciones(marcaproducto,this)) {
MarcaProductoLogicAdditional.updateRelacionesToSave(marcaproducto,this);
if((marcaproducto.getIsNew()||marcaproducto.getIsChanged())&&!marcaproducto.getIsDeleted()) {
this.saveMarcaProducto();
this.saveMarcaProductoRelacionesDetalles(productos,parametroinventariodefectos);
} else if(marcaproducto.getIsDeleted()) {
this.saveMarcaProductoRelacionesDetalles(productos,parametroinventariodefectos);
this.saveMarcaProducto();
}
MarcaProductoLogicAdditional.updateRelacionesToSaveAfter(marcaproducto,this);
} else {
throw new Exception("LOS DATOS SON INVALIDOS");
}
if(conConexion) {connexion.commit();}
} catch(Exception e) {
ProductoConstantesFunciones.InicializarGeneralEntityAuxiliaresProductos(productos,true,true);
ParametroInventarioDefectoConstantesFunciones.InicializarGeneralEntityAuxiliaresParametroInventarioDefectos(parametroinventariodefectos,true,true);
if(conConexion){connexion.rollback();}
Funciones.manageException(logger,e);
throw e;
} finally {
if(conConexion){this.closeNewConnexionToDeep();}
}
}
private void saveMarcaProductoRelacionesDetalles(List<Producto> productos,List<ParametroInventarioDefecto> parametroinventariodefectos)throws Exception {
try {
Long idMarcaProductoActual=this.getMarcaProducto().getId();
ProductoLogic productoLogic_Desde_MarcaProducto=new ProductoLogic();
productoLogic_Desde_MarcaProducto.setProductos(productos);
productoLogic_Desde_MarcaProducto.setConnexion(this.getConnexion());
productoLogic_Desde_MarcaProducto.setDatosCliente(this.datosCliente);
for(Producto producto_Desde_MarcaProducto:productoLogic_Desde_MarcaProducto.getProductos()) {
producto_Desde_MarcaProducto.setid_marca_producto(idMarcaProductoActual);
productoLogic_Desde_MarcaProducto.setProducto(producto_Desde_MarcaProducto);
productoLogic_Desde_MarcaProducto.saveProducto();
}
ParametroInventarioDefectoLogic parametroinventariodefectoLogic_Desde_MarcaProducto=new ParametroInventarioDefectoLogic();
parametroinventariodefectoLogic_Desde_MarcaProducto.setParametroInventarioDefectos(parametroinventariodefectos);
parametroinventariodefectoLogic_Desde_MarcaProducto.setConnexion(this.getConnexion());
parametroinventariodefectoLogic_Desde_MarcaProducto.setDatosCliente(this.datosCliente);
for(ParametroInventarioDefecto parametroinventariodefecto_Desde_MarcaProducto:parametroinventariodefectoLogic_Desde_MarcaProducto.getParametroInventarioDefectos()) {
parametroinventariodefecto_Desde_MarcaProducto.setid_marca_producto(idMarcaProductoActual);
}
parametroinventariodefectoLogic_Desde_MarcaProducto.saveParametroInventarioDefectos();
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
//IF MAX CODE
public static ArrayList<Classe> getClassesForeignKeysOfMarcaProducto(ArrayList<Classe> classesP,DeepLoadType deepLoadType)throws Exception {
try {
ArrayList<Classe> classes=MarcaProductoConstantesFunciones.getClassesForeignKeysOfMarcaProducto(classesP,deepLoadType);
return classes;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
public static ArrayList<Classe> getClassesRelationshipsOfMarcaProducto(ArrayList<Classe> classesP,DeepLoadType deepLoadType)throws Exception {
try {
ArrayList<Classe> classes=MarcaProductoConstantesFunciones.getClassesRelationshipsOfMarcaProducto(classesP,deepLoadType);
return classes;
} catch(Exception e) {
Funciones.manageException(logger,e);
throw e;
}
}
}
|
meesokim/z88dk | examples/console/sorter.c | <reponame>meesokim/z88dk<filename>examples/console/sorter.c<gh_stars>1-10
/* Small C+ Insertion sort!
*
* <NAME> 3/2/1999
*/
#include <stdio.h>
#define SIZE 100
main()
{
int A[SIZE], i, j, tmp;
/* Fill array with descending numbers (worst case) */
i=0;
while (i<SIZE)
A[i] = SIZE-i++;
/* Print initial state of array */
puts("Before:");
printarray(A);
/* Now, er, sort it */
for (i=1; i<SIZE; i++)
{
tmp = A[i];
j=i;
while (j!=0 && A[j-1]>tmp)
A[j]=A[--j];
A[j] = tmp;
}
/* Print sorted version */
puts("After:");
printarray(A);
}
printarray(int A[])
{
int i;
i=0;
while (i<SIZE)
{
printf("%d ", A[i++]);
}
puts("");
}
|
tannerwelsh/code-training | go/gotraining/05-packaging/example6/example6.go | // All material is licensed under the GNU Free Documentation License
// https://github.com/ArdanStudios/gotraining/blob/master/LICENSE
// Sample program to show how to create values from exported types with
// embedded unexported types.
package main
import (
"fmt"
"github.com/ArdanStudios/gotraining/05-packaging/example6/animals"
)
// main is the entry point for the application.
func main() {
/// Create a value of type Dog from the animals package.
dog := animals.Dog{
BarkStrength: 10,
}
// Set the exported fields from the unexported
// animal inner type.
dog.Name = "Chole"
dog.Age = 1
fmt.Printf("Dog: %#v\n", dog)
}
|
theredpea/Arelle | arelle/Version.py | '''
This module represents the time stamp when Arelle was last built
@author: Mark V Systems Limited
(c) Copyright 2015 Mark V Systems Limited, All rights reserved.
'''
version = '2015-03-23 18:13 UTC'
|
Damillora/Altessimo | artists/urls.py | <filename>artists/urls.py<gh_stars>0
from django.urls import path
from . import views
urlpatterns = [
path('',views.artist_index),
path('<slug:slug>',views.artist_show)
]
|
Eternal-Rise/inkline | src/components/INav/manifest.js | <gh_stars>0
export const manifest = {
name: 'nav',
slots: [
{
description: 'Slot for default nav content',
name: 'default'
}
],
props: [
{
name: 'color',
type: [
'light',
'dark'
],
default: 'light',
description: 'The color variant of the nav'
},
{
name: 'size',
type: [
'sm',
'md',
'lg'
],
default: 'md',
description: 'The size variant of the nav'
},
{
name: 'vertical',
type: [
'Boolean'
],
default: 'false',
description: 'Display the nav with vertical orientation'
}
],
styles: [
{
name: 'color',
description: 'The color of the list group component item',
type: 'color',
variants: {
light: 'contrast-color($color-light)',
dark: 'contrast-color($color-dark)'
}
},
{
name: 'color-active',
description: 'The color of the list group component item when active',
type: 'color',
variants: {
light: 'color(\'primary\')',
dark: 'color(\'primary\')'
}
},
{
name: 'color-disabled',
description: 'The color of the list group component item when disabled',
type: 'color',
variants: {
light: 'var(--text-muted)',
dark: 'var(--text-muted)'
}
},
{
name: 'font-size',
description: 'The font size of the modal component',
type: 'size',
default: 'font-size()'
},
{
name: 'padding',
description: 'The padding of the modal component',
type: 'size',
default: 'spacing()'
}
],
events: [],
css: {
variables: [
{
name: 'font-size',
type: 'size',
value: 'font-size()',
description: 'The font size of the nav component'
},
{
name: 'padding-top',
type: 'size',
value: 'var(--padding-top)',
description: 'The padding top of the nav component'
},
{
name: 'padding-right',
type: 'size',
value: 'var(--padding-right)',
description: 'The padding right of the nav component'
},
{
name: 'padding-bottom',
type: 'size',
value: 'var(--padding-bottom)',
description: 'The padding bottom of the nav component'
},
{
name: 'padding-left',
type: 'size',
value: 'var(--padding-left)',
description: 'The padding left of the nav component'
},
{
name: 'padding',
type: '',
value: 'var(----padding-top) var(----padding-right) var(----padding-bottom) var(----padding-left)',
description: 'The padding of the nav component'
},
{
name: 'color',
type: 'color',
value: 'contrast-color($color-light)',
description: ''
},
{
name: 'color-active',
type: 'color',
value: 'color(\'primary\')',
description: 'The color of the nav component item when active'
},
{
name: 'color-disabled',
type: 'color',
value: 'var(--text-muted)',
description: 'The color of the nav component item when disabled'
}
],
variants: [
{
name: 'light',
type: 'variant',
description: 'Variables for the light color variant',
variables: [
{
name: 'color',
type: '',
value: 'contrast-color($color-light)',
description: 'The color of the nav component item, for the light color variant'
},
{
name: 'color--active',
type: '',
value: 'contrast-color($color-primary)',
description: 'The color of the nav component item when active, for the light color variant'
},
{
name: 'color--disabled',
type: '',
value: 'var(--text-muted)',
description: 'The color of the nav component item when disabled, for the light color variant'
}
]
},
{
name: 'dark',
type: 'variant',
description: 'Variables for the dark color variant',
variables: [
{
name: 'color',
type: '',
value: 'contrast-color($color-dark)',
description: 'The color of the nav component item, for the dark color variant'
},
{
name: 'color--active',
type: '',
value: 'contrast-color($color-primary)',
description: 'The color of the nav component item when active, for the dark color variant'
},
{
name: 'color--disabled',
type: '',
value: 'var(--text-muted)',
description: 'The color of the nav component item when disabled, for the dark color variant'
}
]
},
{
name: 'sm',
type: 'variant',
description: 'Variables for the sm size variant',
variables: [
{
name: 'font-size',
type: '',
value: 'calc(#{font-size()} * #{size-multiplier(\'sm\')})',
description: 'The font size of the nav component, for the sm size variant'
},
{
name: 'padding-top',
type: '',
value: 'calc(#{var(--padding-top)} * #{size-multiplier(\'sm\')})',
description: 'The padding top of the nav component, for the sm size variant'
},
{
name: 'padding-right',
type: '',
value: 'calc(#{var(--padding-right)} * #{size-multiplier(\'sm\')})',
description: 'The padding right of the nav component, for the sm size variant'
},
{
name: 'padding-bottom',
type: '',
value: 'calc(#{var(--padding-bottom)} * #{size-multiplier(\'sm\')})',
description: 'The padding bottom of the nav component, for the sm size variant'
},
{
name: 'padding-left',
type: '',
value: 'calc(#{var(--padding-left)} * #{size-multiplier(\'sm\')})',
description: 'The padding left of the nav component, for the sm size variant'
}
]
},
{
name: 'md',
type: 'variant',
description: 'Variables for the md size variant',
variables: [
{
name: 'font-size',
type: '',
value: 'calc(#{font-size()} * #{size-multiplier(\'md\')})',
description: 'The font size of the nav component, for the md size variant'
},
{
name: 'padding-top',
type: '',
value: 'calc(#{var(--padding-top)} * #{size-multiplier(\'md\')})',
description: 'The padding top of the nav component, for the md size variant'
},
{
name: 'padding-right',
type: '',
value: 'calc(#{var(--padding-right)} * #{size-multiplier(\'md\')})',
description: 'The padding right of the nav component, for the md size variant'
},
{
name: 'padding-bottom',
type: '',
value: 'calc(#{var(--padding-bottom)} * #{size-multiplier(\'md\')})',
description: 'The padding bottom of the nav component, for the md size variant'
},
{
name: 'padding-left',
type: '',
value: 'calc(#{var(--padding-left)} * #{size-multiplier(\'md\')})',
description: 'The padding left of the nav component, for the md size variant'
}
]
},
{
name: 'lg',
type: 'variant',
description: 'Variables for the lg size variant',
variables: [
{
name: 'font-size',
type: '',
value: 'calc(#{font-size()} * #{size-multiplier(\'lg\')})',
description: 'The font size of the nav component, for the lg size variant'
},
{
name: 'padding-top',
type: '',
value: 'calc(#{var(--padding-top)} * #{size-multiplier(\'lg\')})',
description: 'The padding top of the nav component, for the lg size variant'
},
{
name: 'padding-right',
type: '',
value: 'calc(#{var(--padding-right)} * #{size-multiplier(\'lg\')})',
description: 'The padding right of the nav component, for the lg size variant'
},
{
name: 'padding-bottom',
type: '',
value: 'calc(#{var(--padding-bottom)} * #{size-multiplier(\'lg\')})',
description: 'The padding bottom of the nav component, for the lg size variant'
},
{
name: 'padding-left',
type: '',
value: 'calc(#{var(--padding-left)} * #{size-multiplier(\'lg\')})',
description: 'The padding left of the nav component, for the lg size variant'
}
]
}
]
}
};
export default manifest;
|
tdc22/JAwesomeEngine | JAwesomeEngine/src/display/GLDisplay.java | <gh_stars>10-100
package display;
import static org.lwjgl.glfw.GLFW.GLFW_ACCUM_ALPHA_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_ACCUM_BLUE_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_ACCUM_GREEN_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_ACCUM_RED_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_ALPHA_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_AUX_BUFFERS;
import static org.lwjgl.glfw.GLFW.GLFW_BLUE_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MAJOR;
import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MINOR;
import static org.lwjgl.glfw.GLFW.GLFW_CURSOR;
import static org.lwjgl.glfw.GLFW.GLFW_CURSOR_DISABLED;
import static org.lwjgl.glfw.GLFW.GLFW_CURSOR_NORMAL;
import static org.lwjgl.glfw.GLFW.GLFW_DEPTH_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_GREEN_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_CORE_PROFILE;
import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_FORWARD_COMPAT;
import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_PROFILE;
import static org.lwjgl.glfw.GLFW.GLFW_RED_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_RESIZABLE;
import static org.lwjgl.glfw.GLFW.GLFW_SAMPLES;
import static org.lwjgl.glfw.GLFW.GLFW_SRGB_CAPABLE;
import static org.lwjgl.glfw.GLFW.GLFW_STENCIL_BITS;
import static org.lwjgl.glfw.GLFW.GLFW_STEREO;
import static org.lwjgl.glfw.GLFW.GLFW_VISIBLE;
import static org.lwjgl.glfw.GLFW.glfwCreateWindow;
import static org.lwjgl.glfw.GLFW.glfwDefaultWindowHints;
import static org.lwjgl.glfw.GLFW.glfwDestroyWindow;
import static org.lwjgl.glfw.GLFW.glfwGetFramebufferSize;
import static org.lwjgl.glfw.GLFW.glfwGetPrimaryMonitor;
import static org.lwjgl.glfw.GLFW.glfwInit;
import static org.lwjgl.glfw.GLFW.glfwMakeContextCurrent;
import static org.lwjgl.glfw.GLFW.glfwPollEvents;
import static org.lwjgl.glfw.GLFW.glfwSetCursorPos;
import static org.lwjgl.glfw.GLFW.glfwSetErrorCallback;
import static org.lwjgl.glfw.GLFW.glfwSetFramebufferSizeCallback;
import static org.lwjgl.glfw.GLFW.glfwSetInputMode;
import static org.lwjgl.glfw.GLFW.glfwSetWindowPos;
import static org.lwjgl.glfw.GLFW.glfwSetWindowPosCallback;
import static org.lwjgl.glfw.GLFW.glfwShowWindow;
import static org.lwjgl.glfw.GLFW.glfwSwapBuffers;
import static org.lwjgl.glfw.GLFW.glfwSwapInterval;
import static org.lwjgl.glfw.GLFW.glfwTerminate;
import static org.lwjgl.glfw.GLFW.glfwWindowHint;
import static org.lwjgl.glfw.GLFW.glfwWindowShouldClose;
import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT;
import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT;
import static org.lwjgl.opengl.GL11.GL_FALSE;
import static org.lwjgl.opengl.GL11.GL_STENCIL_BUFFER_BIT;
import static org.lwjgl.opengl.GL11.GL_TRUE;
import static org.lwjgl.opengl.GL11.glClear;
import static org.lwjgl.system.MemoryUtil.NULL;
import java.nio.IntBuffer;
import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.glfw.GLFWFramebufferSizeCallback;
import org.lwjgl.glfw.GLFWWindowPosCallback;
import org.lwjgl.opengl.GL;
import org.lwjgl.system.MemoryStack;
public class GLDisplay extends Display {
private long windowid;
private GLFWErrorCallback errorCallback;
private GLFWWindowPosCallback posCallback;
private GLFWFramebufferSizeCallback sizeCallback;
private boolean mousebound = false;
@Override
public void bindMouse() {
glfwSetInputMode(windowid, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
// HACK (drop 2 inputs to avoid wrong mouse values)
pollInputs();
resetMouse();
pollInputs();
resetMouse();
mousebound = true;
}
@Override
public void clear() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
@Override
public void close() {
glfwDestroyWindow(windowid);
System.out.println("Terminated!");
if (sizeCallback != null)
sizeCallback.free();
posCallback.free();
glfwTerminate();
errorCallback.free();
}
public long getWindowID() {
return windowid;
}
@Override
public boolean isCloseRequested() {
return glfwWindowShouldClose(windowid);
}
@Override
public boolean isMouseBound() {
return mousebound;
}
@Override
public void open(DisplayMode displaymode, PixelFormat pixelformat) {
glfwSetErrorCallback(errorCallback = GLFWErrorCallback.createPrint(System.err));
if (glfwInit() != true)
throw new IllegalStateException("Unable to initialize GLFW");
// See: http://www.glfw.org/docs/latest/window.html#window_hints_values
glfwDefaultWindowHints();
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
glfwWindowHint(GLFW_RESIZABLE, displaymode.isResizeable() ? GL_TRUE : GL_FALSE);
glfwWindowHint(GLFW_RED_BITS, pixelformat.getBitsPerPixel());
glfwWindowHint(GLFW_GREEN_BITS, pixelformat.getBitsPerPixel());
glfwWindowHint(GLFW_BLUE_BITS, pixelformat.getBitsPerPixel());
glfwWindowHint(GLFW_ALPHA_BITS, pixelformat.getAlpha());
glfwWindowHint(GLFW_DEPTH_BITS, pixelformat.getDepth());
glfwWindowHint(GLFW_STENCIL_BITS, pixelformat.getStencil());
glfwWindowHint(GLFW_ACCUM_RED_BITS, pixelformat.getAccumulationBitsPerPixel());
glfwWindowHint(GLFW_ACCUM_GREEN_BITS, pixelformat.getAccumulationBitsPerPixel());
glfwWindowHint(GLFW_ACCUM_BLUE_BITS, pixelformat.getAccumulationBitsPerPixel());
glfwWindowHint(GLFW_ACCUM_ALPHA_BITS, pixelformat.getAccumulationAlpha());
glfwWindowHint(GLFW_AUX_BUFFERS, pixelformat.getAuxBuffers());
glfwWindowHint(GLFW_SAMPLES, pixelformat.getSamples());
// glfwWindowHint(GLFW_REFRESH_RATE, ???);
glfwWindowHint(GLFW_STEREO, pixelformat.isStereo() ? GL_TRUE : GL_FALSE);
glfwWindowHint(GLFW_SRGB_CAPABLE, pixelformat.isSRGB() ? GL_TRUE : GL_FALSE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, pixelformat.getContextVersionMajor());
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, pixelformat.getContextVersionMinor());
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, pixelformat.isForwardCompatible() ? GL_TRUE : GL_FALSE);
positionX = displaymode.getPositionX();
positionY = displaymode.getPositionY();
width = displaymode.getWidth();
height = displaymode.getHeight();
long monitor = NULL;
if (displaymode.isFullscreen()) {
monitor = glfwGetPrimaryMonitor();
}
windowid = glfwCreateWindow(width, height, displaymode.getTitle(), monitor, NULL);
if (windowid == NULL)
throw new RuntimeException("Failed to create the GLFW window");
if (!displaymode.isFullscreen()) {
// ByteBuffer vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
glfwSetWindowPos(windowid, displaymode.getPositionX(), displaymode.getPositionY());
}
glfwMakeContextCurrent(windowid);
glfwSwapInterval(displaymode.isVSync() ? 1 : 0);
glfwShowWindow(windowid);
// Mac-workaround (creates windows with different size than asked for)
try (MemoryStack stack = MemoryStack.stackPush()) {
IntBuffer w = stack.callocInt(1);
IntBuffer h = stack.callocInt(1);
glfwGetFramebufferSize(windowid, w, h);
width = w.get(0);
height = h.get(0);
}
glfwSetWindowPosCallback(windowid, posCallback = new GLFWWindowPosCallback() {
@Override
public void invoke(long arg0, int x, int y) {
positionX = x;
positionY = y;
}
});
if (displaymode.isResizeable()) {
glfwSetFramebufferSizeCallback(windowid, sizeCallback = new GLFWFramebufferSizeCallback() {
@Override
public void invoke(long arg0, int w, int h) {
width = w;
height = h;
}
});
}
GL.createCapabilities();
}
@Override
public void pollInputs() {
glfwPollEvents();
}
@Override
public void resetMouse() {
glfwSetCursorPos(windowid, 0, 0);
}
@Override
public void swap() {
glfwSwapBuffers(windowid);
}
@Override
public void unbindMouse() {
glfwSetInputMode(windowid, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
mousebound = false;
}
} |
dmascenik/cloudlbs | device/android/sls-app/src/main/java/com/cloudlbs/sls/LocationDataBuffer.java | package com.cloudlbs.sls;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.cloudlbs.sls.core.ISecureLocationService;
import com.cloudlbs.sls.core.LocationData;
import com.cloudlbs.sls.protocol.AppDetailsProto.AppDetailsMessage;
/**
* Contains {@link LocationData} to be picked up by registered apps via
* {@link ISecureLocationService#getData(String)}. This could be the current
* location of this device, as well as locations of other devices and/or fixed
* locations. Data is keyed on the app identifier. On Android, this is the
* package name.
*
* @author <NAME>
*
*/
public class LocationDataBuffer {
/**
* Location data is stored in a HashMap keyed on the guid of the item
* associated with that location. This way, no more than one location is
* stored for a single item at a time.
*/
private Map<String, HashMap<String, LocationData>> data = new ConcurrentHashMap<String, HashMap<String, LocationData>>();
/**
* Adds another {@link LocationData} to the list for this appKey. The most
* recent location is always added to the end of the list.
*
* @param appKey
* @param loc
*/
public void addLocation(AppDetailsMessage appDetails, LocationData loc) {
HashMap<String, LocationData> locs = getDataForKey(appDetails
.getAppIdentifier());
locs.put(loc.getSubjGuid(), loc);
}
/**
* Adds all the {@link LocationData} elements in the list to the appKey's
* list.
*
* @param appKey
* @param locationDataBuffer
*/
public void addLocations(AppDetailsMessage appDetails,
List<LocationData> locationData) {
HashMap<String, LocationData> locs = getDataForKey(appDetails
.getAppIdentifier());
for (LocationData ld : locationData) {
locs.put(ld.getSubjGuid(), ld);
}
}
/**
* Gets the data for the app and clears the list.
*
* @param appDetails
*/
public synchronized List<LocationData> getLocationData(
AppDetailsMessage appDetails) {
String key = appDetails.getAppIdentifier();
HashMap<String, LocationData> ld = getDataForKey(key);
data.remove(key);
return new ArrayList<LocationData>(ld.values());
}
private synchronized HashMap<String, LocationData> getDataForKey(
String appIdentifier) {
HashMap<String, LocationData> locs = data.get(appIdentifier);
if (locs == null) {
locs = new HashMap<String, LocationData>();
data.put(appIdentifier, locs);
}
return locs;
}
}
|
e-ntro-py/GoogleCodeJam-2021 | Qualification Round/reversort.py | # Copyright (c) 2021 kamyu. All rights reserved.
#
# Google Code Jam 2021 Qualification Round - Problem A. Reversort
# https://codingcompetitions.withgoogle.com/codejam/round/000000000043580a/00000000006d0a5c
#
# Time: O(N^2)
# Space: O(1)
#
def min_idx(L, i):
m = i
for j in xrange(i, len(L)):
if L[j] < L[m]:
m = j
return m
def reverse(L, i, j):
while i < j:
L[i], L[j] = L[j], L[i]
i += 1
j -= 1
def reversort():
N = input()
L = map(int, raw_input().strip().split())
result = 0
for i in xrange(len(L)-1):
# m = L.index(min(L[i:])) # Space: O(N)
m = min_idx(L, i) # Space: O(1)
# L[i:m+1] = L[i:m+1][::-1] # Space: O(N)
reverse(L, i, m) # Space: O(1)
result += m-i+1
return result
for case in xrange(input()):
print 'Case #%d: %s' % (case+1, reversort())
|
foxsugar/summer | db/src/main/java/com/code/server/db/model/ClubCharge.java | <filename>db/src/main/java/com/code/server/db/model/ClubCharge.java<gh_stars>10-100
package com.code.server.db.model;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
/**
* Created by sunxianping on 2018/2/27.
*/
@DynamicUpdate
@Entity
@Table(indexes = {@Index(name = "clubId", columnList = "clubId")})
public class ClubCharge {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;//id
private String clubId;//俱乐部id
private long num;//数量
private long nowMoney;//现在的钱数
private String chargeTime;//时间
public int getId() {
return id;
}
public ClubCharge setId(int id) {
this.id = id;
return this;
}
public String getClubId() {
return clubId;
}
public ClubCharge setClubId(String clubId) {
this.clubId = clubId;
return this;
}
public long getNum() {
return num;
}
public ClubCharge setNum(long num) {
this.num = num;
return this;
}
public long getNowMoney() {
return nowMoney;
}
public ClubCharge setNowMoney(long nowMoney) {
this.nowMoney = nowMoney;
return this;
}
public String getChargeTime() {
return chargeTime;
}
public ClubCharge setChargeTime(String chargeTime) {
this.chargeTime = chargeTime;
return this;
}
}
|
YingVickyCao/DesignPatternSample | src/main/java/com/hades/example/designpatterns/factory/_2_simple_factory/GreekPizza.java | <filename>src/main/java/com/hades/example/designpatterns/factory/_2_simple_factory/GreekPizza.java<gh_stars>0
package com.hades.example.designpatterns.factory._2_simple_factory;
public class GreekPizza extends Pizza {
}
|
atwollam/pVACtools | tests/test_input_file_converter.py | import unittest
import os
import sys
import tempfile
from filecmp import cmp
import py_compile
import logging
from testfixtures import LogCapture, StringComparison as S
from .test_utils import *
from lib.input_file_converter import *
class InputFileConverterTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
cls.executable_dir = os.path.join(base_dir, 'lib')
cls.executable = os.path.join(cls.executable_dir, 'input_file_converter.py')
cls.test_data_dir = os.path.join(base_dir, 'tests', 'test_data', 'input_file_converter')
def test_source_compiles(self):
self.assertTrue(py_compile.compile(self.executable))
def test_error_truncated_vcf_middle_of_entry(self):
with self.assertRaises(Exception) as context:
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_truncated_middle.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
converter.execute()
self.assertTrue("VCF is truncated in the middle of an entry near string " in str(context.exception))
def test_error_truncated_vcf_end_of_file(self):
with self.assertRaises(Exception) as context:
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_truncated_end.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
converter.execute()
self.assertTrue('VCF is truncated at the end of the file' in str(context.exception))
def test_wildtype_protein_sequence_with_stop(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_wildtype_sequence_with_stop.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
logging.disable(logging.NOTSET)
with LogCapture() as l:
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
converter.execute()
warn_message = "Transcript WildtypeProtein sequence contains internal stop codon. These can occur in Ensembl transcripts of the biotype polymorphic_pseudogene. Skipping."
logged_str = "".join(l.actual()[0])
self.assertTrue(warn_message in logged_str)
expected_output_file = os.path.join(self.test_data_dir, 'output_wildtype_sequence_with_stop.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_tx_annotation_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input.tx.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_tx.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_with_empty_tx_and_gx_annotations_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input.empty_tx_gx.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_empty_tx_gx.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_gx_annotation_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input.gx.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_gx.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_multiple_transcripts_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_multiple_transcripts.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_multiple_transcripts.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_multiple_transcripts_per_alt_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_multiple_transcripts_per_alt.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_multiple_transcripts_per_alt.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_mutation_at_relative_beginning_of_full_sequence_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_mutation_at_relative_beginning_of_full_sequence.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_mutation_at_relative_beginning_of_full_sequence.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_mutation_at_relative_end_of_full_sequence_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_mutation_at_relative_end_of_full_sequence.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_mutation_at_relative_end_of_full_sequence.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_position_out_of_bounds_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_position_out_of_bounds.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_position_out_of_bounds.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_short_wildtype_sequence_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_short_wildtype_sequence.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_short_wildtype_sequence.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_frameshift_variant_feature_elongation_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_frameshift_variant_feature_elongation.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_frameshift_variant_feature_elongation.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_frameshift_variant_feature_truncation_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_frameshift_variant_feature_truncation.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_frameshift_variant_feature_truncation.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_inframe_insertion_amino_acid_replacement_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_inframe_insertion_aa_replacement.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_inframe_insertion_aa_replacement.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_inframe_deletion_amino_acid_replacement_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_inframe_deletion_aa_replacement.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_inframe_deletion_aa_replacement.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_inframe_insertion_amino_acid_insertion_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_inframe_insertion_aa_insertion.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_inframe_insertion_aa_insertion.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_inframe_deletion_amino_acid_deletion_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_inframe_deletion_aa_deletion.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_inframe_deletion_aa_deletion.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_conflicting_alts_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_conflicting_alts.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_conflicting_alts.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_deletion_and_dash_csq_allele(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_dash_csq_allele.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_dash_csq_allele.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_uncalled_genotype_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_uncalled_genotype.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_uncalled_genotype.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_input_vcf_with_hom_ref_genotype_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_hom_ref_genotype.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_hom_ref_genotype.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_duplicate_index(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_duplicate_index.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_duplicate_index.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_readcount_tags(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input.readcount.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
'sample_name' : 'H_NJ-HCC1395-HCC1395',
'normal_sample_name': 'H_NJ-HCC1395-HCC1396',
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_readcounts.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_missing_csq_format_field_for_variant(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input.no_csq.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_no_csq.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_tsl_vep_field(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_tsl.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_tsl.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_sv_record(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_sv.vcf.gz')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_sv.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_total_length_protein_position(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_total_length.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
'sample_name' : 'TUMOR',
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_total_length.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
def test_agfusion_input_generates_expected_tsv(self):
convert_input_file = os.path.join(self.test_data_dir, 'agfusion')
convert_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_input_file,
'output_file' : convert_output_file.name,
}
converter = FusionInputConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_agfusion.tsv')
self.assertTrue(compare(convert_output_file.name, expected_output_file))
def test_proximal_variants_input(self):
convert_input_file = os.path.join(self.test_data_dir, 'somatic.vcf.gz')
convert_input_proximal_variants_file = os.path.join(self.test_data_dir, 'phased.vcf.gz')
convert_output_file = tempfile.NamedTemporaryFile()
convert_output_proximal_variants_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file': convert_input_file,
'output_file': convert_output_file.name,
'proximal_variants_vcf': convert_input_proximal_variants_file,
'proximal_variants_tsv': convert_output_proximal_variants_file.name,
'flanking_bases': 90,
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_proximal_variants_tsv = os.path.join(self.test_data_dir, 'output_proximal_variants.tsv')
self.assertTrue(cmp(convert_output_proximal_variants_file.name, expected_proximal_variants_tsv))
def test_protein_altering_variants(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_protein_altering_variants.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
'sample_name' : 'TUMOR',
}
converter = VcfConverter(**convert_vcf_params)
self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_protein_altering_variants.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))
|
KamesCG/3id | src/containers/Box/BoxProfile/index.js | <gh_stars>0
/* --- Global Dependencies --- */
import idx from 'idx'
import React from 'react'
/* --- Local Dependencies --- */
import { BoxConsumer } from 'context/Providers/BoxProvider'
import { boxLogo } from 'assets/images'
import { Avatar, Box, Image, Flex, Loading, Heading, Span } from 'atoms'
import { BoxCard } from 'components'
/* --- React Component --- */
class BoxProfile extends React.Component {
constructor(props){
super(props)
this.state = {
isLoading: false
}
this.login = this.login.bind(this)
this.logout = this.logout.bind(this)
}
login() {
this.props.box.open()
this.setState({isLoading: true})
}
logout() {
this.props.box.logout()
this.setState({isLoading: false})
}
// Mounted
componentDidMount()
{
this.props.box.lookupProfile(this.props.address)
}
// Updated
componentDidUpdate()
{
console.log(this.props, 'box card')
}
// Error Catched
componentDidCatch() {
}
render(){
const { box } = this.props
const { isLoading } = this.state
const entity = idx(box, _=>_.entities[this.props.address])
console.log(entity, 'entity')
return(
<BoxCard {...entity}/>
)
}
}
export default (props) =>
<BoxConsumer>
<BoxProfile {...props}/>
</BoxConsumer>
const GenerateImage = image => {
const IPFSFile = hash => `https://ipfs.io/ipfs/${hash}`
const imageipfs = idx(image, _=>_[0].contentUrl['/'])
? IPFSFile(idx(image, _=>_[0].contentUrl['/']))
: null
return imageipfs
} |
AgostonSzepessy/oxshans-battle | Game.cpp | <gh_stars>0
#include "Game.hpp"
Game::Game()
{
window.create(sf::VideoMode(WIDTH, HEIGHT), "Game", sf::Style::Close);
window.setVerticalSyncEnabled(false);
accumulator = 0;
}
void Game::run()
{
init();
int prevTime = c.getElapsedTime().asMilliseconds();
int currentTime = 0;
while (window.isOpen())
{
currentTime = c.getElapsedTime().asMilliseconds();
accumulator += currentTime - prevTime;
prevTime = currentTime;
while (accumulator >= STEP.asMilliseconds())
{
accumulator -= STEP.asMilliseconds();
update();
}
draw();
}
}
void Game::init()
{
gsm.changeState(MenuState::build(&window, &gsm));
}
void Game::update()
{
// check if window is open or get a segfault
if (window.isOpen())
gsm.update();
}
void Game::draw()
{
// check if window is open or get a segfault
if (window.isOpen())
gsm.draw();
}
Game::~Game()
{
}
|
08pixels/juizes-online | go/uri-online-judge/1180.go | package main
import "fmt"
var cases, number int
var lowest, position int
func main() {
fmt.Scan(&cases)
for i := 0; i < cases; i++ {
fmt.Scan(&number)
if lowest > number || i == 0 {
lowest = number
position = i
}
}
fmt.Printf("Menor valor: %d\n", lowest)
fmt.Printf("Posicao: %d\n", position)
}
|
athenagroup/brxm | cms/editor/frontend/src/main/java/org/hippoecm/frontend/editor/impl/EditableTypes.java | <reponame>athenagroup/brxm<filename>cms/editor/frontend/src/main/java/org/hippoecm/frontend/editor/impl/EditableTypes.java
/*
* Copyright 2008-2013 <NAME>.V. (http://www.onehippo.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.hippoecm.frontend.editor.impl;
import java.io.Serializable;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import javax.jcr.NamespaceException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
import javax.jcr.observation.Event;
import javax.jcr.observation.EventIterator;
import javax.jcr.query.Query;
import javax.jcr.query.QueryManager;
import org.apache.wicket.Session;
import org.hippoecm.editor.EditorNodeType;
import org.hippoecm.frontend.model.event.EventCollection;
import org.hippoecm.frontend.model.event.IEvent;
import org.hippoecm.frontend.model.event.IObservable;
import org.hippoecm.frontend.model.event.IObservationContext;
import org.hippoecm.frontend.model.event.JcrEventListener;
import org.hippoecm.frontend.session.UserSession;
import org.hippoecm.repository.api.HippoNodeType;
class EditableTypes extends AbstractList implements Serializable, IObservable {
private static final long serialVersionUID = 1L;
private IObservationContext obContext;
private JcrEventListener listener;
private List<String> entries;
EditableTypes() {
entries = load();
}
List<String> load() {
List<String> editableTypes = new ArrayList<String>();
javax.jcr.Session session = UserSession.get().getJcrSession();
try {
QueryManager qMgr = session.getWorkspace().getQueryManager();
Query query = qMgr.createQuery("//element(*, " + EditorNodeType.NT_EDITABLE + ")", Query.XPATH);
NodeIterator iter = query.execute().getNodes();
Set<String> types = new TreeSet<String>();
while (iter.hasNext()) {
Node ttNode = iter.nextNode();
TemplateEngine.log.debug("search result: {}", ttNode.getPath());
// verify that parent is of correct type
Node nsNode = ttNode.getParent();
if (!nsNode.isNodeType(HippoNodeType.NT_NAMESPACE)) {
continue;
}
String name;
if ("system".equals(nsNode.getName())) {
name = ttNode.getName();
} else if ("hippo".equals(nsNode.getName())) {
name = "hippo:" + ttNode.getName();
} else {
name = nsNode.getName() + ":" + ttNode.getName();
String namespace;
try {
namespace = nsNode.getSession().getNamespaceURI(nsNode.getName());
} catch (NamespaceException ex) {
continue;
}
Node ntNode = null;
Node ntVersions = ttNode.getNode(HippoNodeType.HIPPOSYSEDIT_NODETYPE);
NodeIterator ntVersionIter = ntVersions.getNodes();
while (ntVersionIter.hasNext()) {
Node ntVersion = ntVersionIter.nextNode();
if (ntVersion.isNodeType(HippoNodeType.NT_REMODEL)) {
if (ntVersion.getProperty(HippoNodeType.HIPPO_URI).getString().equals(namespace)) {
ntNode = ntVersion;
}
}
}
if (ntNode == null) {
continue;
}
}
types.add(name);
}
editableTypes.addAll(types);
} catch (RepositoryException ex) {
TemplateEngine.log.error("Unable to enumerate editable types", ex);
}
return editableTypes;
}
@Override
public Object get(int index) {
return entries.get(index);
}
@Override
public int size() {
return entries.size();
}
public void setObservationContext(IObservationContext context) {
this.obContext = context;
}
public void startObservation() {
listener = new JcrEventListener(obContext, Event.NODE_ADDED | Event.NODE_REMOVED, "/", true, null,
new String[] { HippoNodeType.NT_NAMESPACE }) {
@Override
public void onEvent(EventIterator events) {
EventCollection<IEvent<IObservable>> collection = new EventCollection<IEvent<IObservable>>();
collection.add(new IEvent<IObservable>() {
public IObservable getSource() {
return EditableTypes.this;
}
});
List<String> oldEntries = entries;
entries = load();
for (String newEntry : entries) {
if (!oldEntries.contains(newEntry)) {
obContext.notifyObservers(collection);
return;
}
}
for (String oldEntry : oldEntries) {
if (!entries.contains(oldEntry)) {
obContext.notifyObservers(collection);
return;
}
}
}
};
listener.start();
}
public void stopObservation() {
listener.stop();
}
@Override
public boolean equals(Object o) {
return (o instanceof EditableTypes);
}
@Override
public int hashCode() {
return 345997;
}
}
|
nocarryr/Control | BlackBerry/Widget/framework/ext/src/com/phonegap/api/PluginManager.java | <reponame>nocarryr/Control
/*
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
*
* Copyright (c) 2005-2010, Nitobi Software Inc.
* Copyright (c) 2010, IBM Corporation
*/
package com.phonegap.api;
import java.util.Hashtable;
import net.rim.device.api.script.Scriptable;
import net.rim.device.api.script.ScriptableFunction;
import com.phonegap.PhoneGapExtension;
/**
* PluginManager represents an object in the script engine. It can be accessed
* from the script environment using <code>phonegap.PluginManager</code>.
*
* PluginManager provides a function, <code>exec</code>, that can be invoked
* from the script environment: <code>phonegap.PluginManager.exec(...)</code>.
* Invoking this function causes the script engine to load the appropriate
* PhoneGap Plugin and perform the specified action.
*/
public final class PluginManager extends Scriptable {
/**
* Field used to invoke Plugin actions.
*/
public static final String FIELD_EXEC = "exec";
/**
* Field used to cleanup Plugins.
*/
public static final String FIELD_DESTROY = "destroy";
/**
* Loads the appropriate PhoneGap Plugins and invokes their actions.
*/
private final PluginManagerFunction pluginManagerFunction;
/**
* Maps available services to Java class names.
*/
private Hashtable services = new Hashtable();
/**
* Constructor. Adds available PhoneGap services.
* @param ext The PhoneGap JavaScript Extension
*/
public PluginManager(PhoneGapExtension ext) {
this.pluginManagerFunction = new PluginManagerFunction(ext, this);
this.addService("Camera", "com.phonegap.camera.Camera");
this.addService("Network Status", "com.phonegap.network.Network");
this.addService("Notification", "com.phonegap.notification.Notification");
this.addService("Accelerometer", "com.phonegap.accelerometer.Accelerometer");
this.addService("Geolocation", "com.phonegap.geolocation.Geolocation");
this.addService("File", "com.phonegap.file.FileManager");
}
/**
* The following fields are supported from the script environment:
*
* <code>phonegap.pluginManager.exec</code> - Loads the appropriate
* Plugin and invokes the specified action.
*
* <code>phonegap.pluginManager.destroy</code> - Invokes the <code>onDestroy</code>
* method on all Plugins to give them a chance to cleanup before exit.
*/
public Object getField(String name) throws Exception {
if (name.equals(FIELD_EXEC)) {
return this.pluginManagerFunction;
}
else if (name.equals(FIELD_DESTROY)) {
final PluginManagerFunction plugin_mgr = this.pluginManagerFunction;
return new ScriptableFunction() {
public Object invoke(Object obj, Object[] oargs) throws Exception {
plugin_mgr.onDestroy();
return null;
}
};
}
return super.getField(name);
}
/**
* Add a class that implements a service.
*
* @param serviceType
* @param className
*/
public void addService(String serviceType, String className) {
this.services.put(serviceType, className);
}
/**
* Get the class that implements a service.
*
* @param serviceType
* @return
*/
public String getClassForService(String serviceType) {
return (String)this.services.get(serviceType);
}
} |
aravindakr95/todo-app-backend | src/routes/auth.spec.js | <filename>src/routes/auth.spec.js
describe('Auth Router tests', () => {
const postSpy = jest.fn();
jest.doMock('express', () => ({
Router() {
return {
post: postSpy,
};
},
}));
afterAll(() => {
jest.resetAllMocks();
});
test('should invoke register route', () => {
expect(postSpy).toHaveBeenCalledWith('/register');
});
test('should invoke login route', () => {
expect(postSpy).toHaveBeenCalledWith('/login');
});
});
|
dsanmartins/PhdProject | br.ufscar.sas.xtext.sasdsl.ide/src-gen/br/ufscar/sas/xtext/sasdsl/ide/AbstractSasDslIdeModule.java | /*
* generated by Xtext 2.21.0
*/
package br.ufscar.sas.xtext.sasdsl.ide;
import br.ufscar.sas.xtext.sasdsl.ide.contentassist.antlr.SasDslParser;
import br.ufscar.sas.xtext.sasdsl.ide.contentassist.antlr.internal.InternalSasDslLexer;
import com.google.inject.Binder;
import com.google.inject.name.Names;
import org.eclipse.xtext.ide.DefaultIdeModule;
import org.eclipse.xtext.ide.LexerIdeBindings;
import org.eclipse.xtext.ide.editor.contentassist.FQNPrefixMatcher;
import org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher;
import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper;
import org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper;
import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser;
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;
import org.eclipse.xtext.ide.refactoring.IRenameStrategy2;
import org.eclipse.xtext.ide.server.rename.IRenameService2;
import org.eclipse.xtext.ide.server.rename.RenameService2;
/**
* Manual modifications go to {@link SasDslIdeModule}.
*/
@SuppressWarnings("all")
public abstract class AbstractSasDslIdeModule extends DefaultIdeModule {
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public void configureContentAssistLexer(Binder binder) {
binder.bind(Lexer.class)
.annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST))
.to(InternalSasDslLexer.class);
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends IContentAssistParser> bindIContentAssistParser() {
return SasDslParser.class;
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends IProposalConflictHelper> bindIProposalConflictHelper() {
return AntlrProposalConflictHelper.class;
}
// contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2
public Class<? extends IPrefixMatcher> bindIPrefixMatcher() {
return FQNPrefixMatcher.class;
}
// contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2
public Class<? extends IRenameService2> bindIRenameService2() {
return RenameService2.class;
}
// contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2
public Class<? extends IRenameStrategy2> bindIRenameStrategy2() {
return IRenameStrategy2.DefaultImpl.class;
}
}
|
juansanchez49/framework-test | wishlist/app/com/commercetools/sunrise/wishlist/AbstractShoppingListCreateExecutor.java | <filename>wishlist/app/com/commercetools/sunrise/wishlist/AbstractShoppingListCreateExecutor.java
package com.commercetools.sunrise.wishlist;
import com.commercetools.sunrise.framework.controllers.AbstractSphereRequestExecutor;
import com.commercetools.sunrise.framework.hooks.HookRunner;
import com.commercetools.sunrise.framework.hooks.ctpevents.ShoppingListCreatedHook;
import com.commercetools.sunrise.framework.hooks.ctprequests.ShoppingListCreateCommandHook;
import io.sphere.sdk.client.SphereClient;
import io.sphere.sdk.shoppinglists.ShoppingList;
import io.sphere.sdk.shoppinglists.commands.ShoppingListCreateCommand;
import play.libs.concurrent.HttpExecution;
import java.util.concurrent.CompletionStage;
/**
* This base class provides an execution strategy for executing a {@link ShoppingListCreateCommand}
* with the registered hooks {@link ShoppingListCreateCommandHook} and {@link ShoppingListCreatedHook}.
*/
public abstract class AbstractShoppingListCreateExecutor extends AbstractSphereRequestExecutor {
protected AbstractShoppingListCreateExecutor(final SphereClient sphereClient, final HookRunner hookRunner) {
super(sphereClient, hookRunner);
}
protected final CompletionStage<ShoppingList> executeRequest(final ShoppingListCreateCommand baseCommand) {
final ShoppingListCreateCommand command = ShoppingListCreateCommandHook.runHook(getHookRunner(), baseCommand);
return getSphereClient().execute(command)
.thenApplyAsync(cart -> {
ShoppingListCreatedHook.runHook(getHookRunner(), cart);
return cart;
}, HttpExecution.defaultContext());
}
}
|
shengqianlong/we-cloud-java-sdk | we-cloud-sdk-storage/src/main/java/cn/wecloud/sdk/storage/model/WeCloudStorageUploadImageModel.java | package cn.wecloud.sdk.storage.model;
import cn.wecloud.sdk.storage.data.WeCloudStorageCustomImageInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @author 陈俊雄
* @since 2020/10/22
**/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class WeCloudStorageUploadImageModel extends WeCloudStorageUploadFileModel {
private WeCloudStorageCustomImageInfo customImageInfo;
}
|
ashley/codemining-treelm | src/main/java/codemining/lm/tsg/idioms/PatternCorpus.java | /**
*
*/
package codemining.lm.tsg.idioms;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.lang.exception.ExceptionUtils;
import codemining.ast.TreeNode;
import codemining.ast.java.AbstractJavaTreeExtractor;
import codemining.java.codeutils.JavaASTExtractor;
import codemining.java.tokenizers.JavaTokenizer;
import codemining.lm.tsg.FormattedTSGrammar;
import codemining.lm.tsg.TSGNode;
import codemining.util.CollectionUtil;
import codemining.util.SettingsLoader;
import codemining.util.serialization.ISerializationStrategy.SerializationException;
import codemining.util.serialization.Serializer;
import com.esotericsoftware.kryo.DefaultSerializer;
import com.esotericsoftware.kryo.serializers.JavaSerializer;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multiset;
import com.google.common.collect.Multiset.Entry;
import com.google.common.collect.Sets;
/**
* A class that contains patterns.
*
* @author <NAME> <<EMAIL>>
*
*/
@DefaultSerializer(JavaSerializer.class)
public class PatternCorpus implements Serializable {
/**
* Return the list of patterns of a specific tree.
*/
public static Multiset<TreeNode<Integer>> getPatternsForTree(
final TreeNode<Integer> tree, final Set<TreeNode<Integer>> patterns) {
final Multiset<TreeNode<Integer>> treePatterns = HashMultiset.create();
final ArrayDeque<TreeNode<Integer>> toLook = new ArrayDeque<TreeNode<Integer>>();
toLook.push(tree);
// Do a pre-order visit
while (!toLook.isEmpty()) {
final TreeNode<Integer> currentNode = toLook.pop();
// at each node check if we have a partial match with any of the
// patterns
for (final TreeNode<Integer> pattern : patterns) {
if (pattern.partialMatch(currentNode,
PatternStatsCalculator.BASE_EQUALITY_COMPARATOR, false)) {
treePatterns.add(pattern);
}
}
// Proceed visiting
for (final List<TreeNode<Integer>> childProperties : currentNode
.getChildrenByProperty()) {
for (final TreeNode<Integer> child : childProperties) {
toLook.push(child);
}
}
}
return treePatterns;
}
/**
* Return the list of patterns a specific tree.
*/
public static double getPatternsForTree(final TreeNode<Integer> tree,
final Set<TreeNode<Integer>> patterns,
final Set<TreeNode<Integer>> patternSeen) {
final ArrayDeque<TreeNode<Integer>> toLook = new ArrayDeque<TreeNode<Integer>>();
toLook.push(tree);
final Map<TreeNode<Integer>, Long> matches = Maps.newIdentityHashMap();
// Do a pre-order visit
while (!toLook.isEmpty()) {
final TreeNode<Integer> currentNode = toLook.pop();
// at each node check if we have a partial match with any of the
// patterns
for (final TreeNode<Integer> pattern : patterns) {
if (pattern.partialMatch(currentNode,
PatternStatsCalculator.BASE_EQUALITY_COMPARATOR, false)) {
patternSeen.add(pattern);
for (final TreeNode<Integer> node : currentNode
.getOverlappingNodesWith(pattern)) {
if (matches.containsKey(node)) {
matches.put(node, matches.get(node) + 1L);
} else {
matches.put(node, 1L);
}
}
}
}
// Proceed visiting
for (final List<TreeNode<Integer>> childProperties : currentNode
.getChildrenByProperty()) {
for (final TreeNode<Integer> child : childProperties) {
toLook.push(child);
}
}
}
long sumOfMatches = 0;
for (final long count : matches.values()) {
sumOfMatches += count;
}
return ((double) sumOfMatches) / matches.size();
}
/**
* Get a set of patterns given the default min count and min size.
*
* @param grammar
* @return
*/
public static Set<TreeNode<Integer>> getPatternsFrom(
final FormattedTSGrammar grammar) {
return getPatternsFrom(grammar, MIN_PATTERN_COUNT, MIN_PATTERN_SIZE);
}
/**
* Return a list of patterns in the given TSG grammar.
*
* @param grammar
* @return
*/
public static Set<TreeNode<Integer>> getPatternsFrom(
final FormattedTSGrammar grammar, final int minPatternCount,
final int minPatternSize) {
final Set<TreeNode<Integer>> patterns = Sets.newHashSet();
for (final Multiset<TreeNode<TSGNode>> rules : grammar
.getInternalGrammar().values()) {
for (final Entry<TreeNode<TSGNode>> ruleEntry : rules.entrySet()) {
if (isPattern(ruleEntry, minPatternCount, minPatternSize)) {
patterns.add(TSGNode.tsgTreeToInt(ruleEntry.getElement()));
}
}
}
return patterns;
}
/**
* @param ruleEntry
* @return
*/
protected static boolean isPattern(
final Entry<TreeNode<TSGNode>> ruleEntry,
final int minPatternCount, final int minPatternSize) {
return ruleEntry.getCount() >= minPatternCount
&& ruleEntry.getElement().getTreeSize() >= minPatternSize;
}
public static void main(final String[] args) throws SerializationException {
if (args.length < 3) {
System.err
.println("Usage <tsg.ser> <minPatternCount> <minPatternSize> [<minTimesInFilterDir> <filterDir>...]");
System.exit(-1);
}
final FormattedTSGrammar grammar = (FormattedTSGrammar) Serializer
.getSerializer().deserializeFrom(args[0]);
final int minCount = Integer.parseInt(args[1]);
final int minSize = Integer.parseInt(args[2]);
final PatternCorpus corpus = new PatternCorpus(
(AbstractJavaTreeExtractor) grammar.getTreeExtractor());
corpus.addFromGrammar(grammar, minCount, minSize);
if (args.length >= 5) {
final int nTimesSeen = Integer.parseInt(args[3]);
final List<File> directories = Lists.newArrayList();
for (int i = 4; i < args.length; i++) {
directories.add(new File(args[i]));
}
corpus.filterFromFiles(directories, nTimesSeen);
}
Serializer.getSerializer().serialize(corpus, "patterns.ser");
}
/**
* @param format
* @param patterns
* @param directory
* @return
*/
public static Set<TreeNode<Integer>> patternsSeenInCorpus(
final AbstractJavaTreeExtractor format,
final Set<TreeNode<Integer>> patterns, final File directory) {
final Collection<File> allFiles = FileUtils
.listFiles(directory, JavaTokenizer.javaCodeFileFilter,
DirectoryFileFilter.DIRECTORY);
final Set<TreeNode<Integer>> patternSeenInCorpus = Sets
.newIdentityHashSet();
for (final File f : allFiles) {
try {
final TreeNode<Integer> fileAst = format.getTree(f);
getPatternsForTree(fileAst, patterns, patternSeenInCorpus);
} catch (final IOException e) {
PatternInSet.LOGGER
.warning(ExceptionUtils.getFullStackTrace(e));
}
}
return patternSeenInCorpus;
}
private static final long serialVersionUID = 8309734116605145468L;
/**
* The minimum size of a TSG rule to be considered as a pattern.
*/
public static final int MIN_PATTERN_SIZE = (int) SettingsLoader
.getNumericSetting("minSizePattern", 7);
/**
* The minimum count of a TSG rule to be considered a pattern.
*/
public static final int MIN_PATTERN_COUNT = (int) SettingsLoader
.getNumericSetting("minPatternCount", 10);
static final Logger LOGGER = Logger
.getLogger(PatternCorpus.class.getName());
/**
* The list of patterns.
*/
private final Set<TreeNode<Integer>> patterns = Sets.newHashSet();
private final AbstractJavaTreeExtractor format;
public PatternCorpus(final AbstractJavaTreeExtractor format) {
this.format = format;
}
/**
* Extract all rules from the grammar as patterns.
*
* @param grammar
*/
public void addFromGrammar(final FormattedTSGrammar grammar,
final int minPatternCount, final int minPatternSize) {
patterns.addAll(getPatternsFrom(grammar, minPatternCount,
minPatternSize));
}
public void addPattern(final TreeNode<Integer> tree) {
patterns.add(tree);
}
/**
* Filter all patterns so that they are contained in at least one of the
* files.
*
* @param directory
* @param nSeenInFiles
* number of times seen in the files.
*/
public void filterFromFiles(final Collection<File> directories,
final int nSeenInFiles) {
final Multiset<TreeNode<Integer>> patternsSeen = HashMultiset.create();
for (final File directory : directories) {
final Collection<File> directoryFiles = FileUtils.listFiles(
directory, JavaTokenizer.javaCodeFileFilter,
DirectoryFileFilter.DIRECTORY);
for (final File f : directoryFiles) {
try {
// We add the patterns once per file.
patternsSeen.addAll(getPatternsFromTree(format.getTree(f))
.elementSet());
} catch (final IOException e) {
LOGGER.warning(ExceptionUtils.getFullStackTrace(e));
}
}
}
// patternsSeen now contains the number of files that each pattern has
// been seen.
final Set<TreeNode<Integer>> toKeep = CollectionUtil
.getElementsUpToCount(nSeenInFiles, patternsSeen);
patterns.retainAll(toKeep);
}
public AbstractJavaTreeExtractor getFormat() {
return format;
}
public Set<TreeNode<Integer>> getNodesCovered(final File f)
throws IOException {
return getNodesCovered(format.getTree(f));
}
public Set<TreeNode<Integer>> getNodesCovered(final String snippet)
throws Exception {
final JavaASTExtractor ex = new JavaASTExtractor(false);
return getNodesCovered(format.getTree(ex.getBestEffortAstNode(snippet)));
}
/**
* Return the set of covered nodes
*
* @param tree
* @return
*/
public Set<TreeNode<Integer>> getNodesCovered(final TreeNode<Integer> tree) {
final Set<TreeNode<Integer>> overlappingNodes = Sets
.newIdentityHashSet();
final ArrayDeque<TreeNode<Integer>> toLook = new ArrayDeque<TreeNode<Integer>>();
toLook.push(tree);
// Do a pre-order visit
while (!toLook.isEmpty()) {
final TreeNode<Integer> currentNode = toLook.pop();
// at each node check if we have a partial match with the
// current patterns
for (final TreeNode<Integer> pattern : patterns) {
if (pattern.partialMatch(currentNode,
PatternStatsCalculator.BASE_EQUALITY_COMPARATOR, false)) {
overlappingNodes.addAll(currentNode
.getOverlappingNodesWith(pattern));
}
}
// Proceed visiting
for (final List<TreeNode<Integer>> childProperties : currentNode
.getChildrenByProperty()) {
for (final TreeNode<Integer> child : childProperties) {
toLook.push(child);
}
}
}
return overlappingNodes;
}
public Set<TreeNode<Integer>> getPatterns() {
return patterns;
}
public Multiset<TreeNode<Integer>> getPatternsFrom(final File f)
throws IOException {
return getPatternsFromTree(format.getTree(f));
}
public Multiset<TreeNode<Integer>> getPatternsFrom(final String snippet)
throws Exception {
final JavaASTExtractor ex = new JavaASTExtractor(false);
return getPatternsFromTree(format.getTree(ex
.getBestEffortAstNode(snippet)));
}
/**
* Return the set of patterns for this tree.
*/
public Multiset<TreeNode<Integer>> getPatternsFromTree(
final TreeNode<Integer> tree) {
return getPatternsForTree(tree, patterns);
}
}
|
joey3060/deeperience_web | src/server/utils/filterAttribute.js | <filename>src/server/utils/filterAttribute.js
// prevent SQL injection that inject different attribute
export default (obj, allowedAttributes, disAllow = false) => {
const resultObj = {}
Object
.keys(obj)
.filter(attribute =>
disAllow ?
allowedAttributes.indexOf(attribute) < 0 :
allowedAttributes.indexOf(attribute) >= 0
)
.forEach(attribute => {
resultObj[attribute] = obj[attribute]
})
return resultObj
}
|
abramovdmitrii/jest | packages/jest-cli/src/pluralize.js | <reponame>abramovdmitrii/jest<gh_stars>1-10
export default function pluralize(word: string, count: number, ending: string) {
return `${count} ${word}${count === 1 ? '' : ending}`;
}
|
DJilanov/react-node-docker-sample | backend/data/db/db-context.js | <reponame>DJilanov/react-node-docker-sample
const mongoose = require('mongoose');
// Initialize the database connector
const init = databaseConfig => new Promise((resolve) => {
connectDb(databaseConfig, resolve);
});
const connectDb = (databaseConfig, resolve) => {
// If the connection throws an error
mongoose.connection.on('error', (err) => {
console.log('[dbConnector]Mongoose default connection error: ' + err);
mongoose.disconnect();
});
// When the connection is disconnected try to reconnect manually
mongoose.connection.on('disconnected', () => {
console.log('[dbConnector]Mongoose default connection disconnected');
mongoose.connect(databaseConfig.dbAddress, { useNewUrlParser: true });
});
// If the Node process ends, close the Mongoose connection
process.on('SIGINT', () => {
mongoose.connection.close(() => {
console.log('[dbConnector]Mongoose default connection disconnected through app termination');
process.exit(0);
});
});
// get database
mongoose.connect(databaseConfig.dbAddress, { useNewUrlParser: true } ,(err) => {
// if we failed to connect, abort
if (err) {
throw err;
}
resolve(true);
})
}
module.exports = {
init
};
|
gino0631/santuario-java | src/main/java/org/apache/xml/security/stax/impl/securityToken/DsaKeyValueSecurityToken.java | /**
* 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.xml.security.stax.impl.securityToken;
import org.apache.xml.security.binding.xmldsig.DSAKeyValueType;
import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.stax.ext.InboundSecurityContext;
import org.apache.xml.security.stax.impl.util.IDGenerator;
import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
import java.math.BigInteger;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.spec.DSAPublicKeySpec;
import java.security.spec.InvalidKeySpecException;
/**
*/
public class DsaKeyValueSecurityToken extends AbstractInboundSecurityToken {
private DSAKeyValueType dsaKeyValueType;
public DsaKeyValueSecurityToken(DSAKeyValueType dsaKeyValueType, InboundSecurityContext inboundSecurityContext) {
super(inboundSecurityContext, IDGenerator.generateID(null), SecurityTokenConstants.KeyIdentifier_KeyValue, true);
this.dsaKeyValueType = dsaKeyValueType;
}
private PublicKey buildPublicKey(DSAKeyValueType dsaKeyValueType) throws InvalidKeySpecException, NoSuchAlgorithmException {
DSAPublicKeySpec dsaPublicKeySpec = new DSAPublicKeySpec(
new BigInteger(1, dsaKeyValueType.getY()),
new BigInteger(1, dsaKeyValueType.getP()),
new BigInteger(1, dsaKeyValueType.getQ()),
new BigInteger(1, dsaKeyValueType.getG()));
KeyFactory keyFactory = KeyFactory.getInstance("DSA");
return keyFactory.generatePublic(dsaPublicKeySpec);
}
@Override
public PublicKey getPublicKey() throws XMLSecurityException {
if (super.getPublicKey() == null) {
try {
setPublicKey(buildPublicKey(this.dsaKeyValueType));
} catch (InvalidKeySpecException e) {
throw new XMLSecurityException(e);
} catch (NoSuchAlgorithmException e) {
throw new XMLSecurityException(e);
}
}
return super.getPublicKey();
}
@Override
public boolean isAsymmetric() {
return true;
}
@Override
public SecurityTokenConstants.TokenType getTokenType() {
return SecurityTokenConstants.KeyValueToken;
}
}
|
kazunetakahashi/atcoder | 201510_201609/0224/tdpc_E.cpp | #include <iostream>
#include <string>
using namespace std;
typedef long long ll;
ll dp[10][10010][100];
ll M = 1000000007;
int main() {
int D;
string N;
cin >> D >> N;
dp[1][0][0] = 1;
for (auto k = 1; k < D; k++) {
dp[1][0][k] = 0;
}
for (auto j = 1; j < 10010; j++) {
for (auto k = 0; k < D; k++) {
dp[1][j][k] = 0;
for (auto i = 0; i < 10; i++) {
dp[1][j][k] += dp[1][j-1][(k-i+10*D)%D];
dp[1][j][k] %= M;
}
}
}
for (auto i = 2; i < 10; i++) {
for (auto j = 0; j < 10010; j++) {
for (auto k = 0; k < D; k++) {
dp[i][j][k] = dp[i-1][j][k];
dp[i][j][k] += dp[1][j][(k-(i-1)+10*D)%D];
dp[i][j][k] %= M;
}
}
}
/*
for (auto i = 1; i < 10; i++) {
for (auto j = 0; j < 10; j++) {
for (auto k = 0; k < D; k++) {
cout << "dp[" << i << "]["
<< j << "][" << k << "] = " << dp[i][j][k] << endl;
}
}
}
*/
int amari = 0;
int sum = 0;
ll ans = 0;
for (unsigned i = 0; i < N.size(); i++) {
int x = N[i] - '0';
int y = (int)N.size() - 1 - (int)i;
int z = (D - amari)%D;
if (x == 0) continue;
ans += dp[x][y][z];
//cerr << "x = " << x << ", y = " << y << ", z = " << z << endl;
ans %= M;
amari += x;
amari %= D;
sum += x;
}
ans += M-1;
ans %= M;
if (sum%D == 0) {
ans += 1;
ans %= M;
}
cout << ans << endl;
}
|
boxheed/nitrite-java | nitrite-replication/src/test/java/org/dizitart/no2/integration/ReplicaTest.java | /*
* Copyright (c) 2017-2020. Nitrite 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 org.dizitart.no2.integration;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.dizitart.no2.Nitrite;
import org.dizitart.no2.collection.Document;
import org.dizitart.no2.collection.NitriteCollection;
import org.dizitart.no2.filters.Filter;
import org.dizitart.no2.sync.Replica;
import org.dizitart.no2.sync.ReplicationTemplate;
import org.dizitart.no2.sync.crdt.LastWriteWinMap;
import org.dizitart.no2.integration.server.Repository;
import org.dizitart.no2.integration.server.SimpleDataGateServer;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import java.io.File;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.awaitility.Awaitility.await;
import static org.dizitart.no2.collection.Document.createDocument;
import static org.dizitart.no2.common.util.DocumentUtils.isSimilar;
import static org.dizitart.no2.filters.FluentFilter.where;
import static org.dizitart.no2.integration.TestUtils.createDb;
import static org.dizitart.no2.integration.TestUtils.randomDocument;
import static org.junit.Assert.*;
/**
* @author <NAME>
*/
@Slf4j
public class ReplicaTest {
private static SimpleDataGateServer server;
private String dbFile;
private ExecutorService executorService;
private Repository repository;
private Nitrite db;
@Rule
public Retry retry = new Retry(3);
public static String getRandomTempDbFile() {
String dataDir = System.getProperty("java.io.tmpdir") + File.separator + "nitrite" + File.separator + "data";
File file = new File(dataDir);
if (!file.exists()) {
assertTrue(file.mkdirs());
}
return file.getPath() + File.separator + UUID.randomUUID().toString() + ".db";
}
@Before
public void setUp() throws Exception {
server = new SimpleDataGateServer(9090);
server.start();
dbFile = getRandomTempDbFile();
executorService = Executors.newCachedThreadPool();
repository = Repository.getInstance();
}
@After
public void cleanUp() throws Exception {
executorService.awaitTermination(2, SECONDS);
executorService.shutdown();
if (db != null && !db.isClosed()) {
db.close();
}
if (Files.exists(Paths.get(dbFile))) {
Files.delete(Paths.get(dbFile));
}
server.stop();
}
@Test
public void testSingleUserSingleReplica() {
repository.getUserMap().put("anidotnet", "abcd");
db = createDb(dbFile);
NitriteCollection collection = db.getCollection("testSingleUserSingleReplica");
Document document = createDocument().put("firstName", "Anindya")
.put("lastName", "Chatterjee")
.put("address", createDocument("street", "1234 Abcd Street")
.put("pin", 123456));
collection.insert(document);
Replica replica = Replica.builder()
.of(collection)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testSingleUserSingleReplica")
.jwtAuth("anidotnet", "<PASSWORD>")
.create();
replica.connect();
await().atMost(5, SECONDS).until(() -> repository.getCollectionReplicaMap().size() == 1);
assertEquals(repository.getUserReplicaMap().size(), 1);
assertTrue(repository.getUserReplicaMap().containsKey("anidotnet"));
assertTrue(repository.getCollectionReplicaMap().containsKey("anidotnet@testSingleUserSingleReplica"));
LastWriteWinMap lastWriteWinMap = repository.getReplicaStore().get("anidotnet@testSingleUserSingleReplica");
await().atMost(5, SECONDS).until(() -> lastWriteWinMap.getCollection().find().size() == 1);
Document doc = lastWriteWinMap.getCollection().find(where("firstName").eq("Anindya")).firstOrNull();
assertTrue(isSimilar(document, doc, "firstName", "lastName", "address", "pin"));
collection.remove(doc);
await().atMost(5, SECONDS).until(() -> lastWriteWinMap.getCollection().size() == 0);
doc = lastWriteWinMap.getCollection().find(where("firstName").eq("Anindya")).firstOrNull();
assertNull(doc);
assertEquals(collection.size(), 0);
collection.insert(document);
await().atMost(5, SECONDS).until(() -> lastWriteWinMap.getCollection().size() == 1);
doc = lastWriteWinMap.getCollection().find(where("firstName").eq("Anindya")).firstOrNull();
assertTrue(isSimilar(document, doc, "firstName", "lastName", "address", "pin"));
replica.disconnect();
collection.remove(doc);
await().atMost(5, SECONDS).until(() -> lastWriteWinMap.getCollection().size() == 1);
doc = lastWriteWinMap.getCollection().find(where("firstName").eq("Anindya")).firstOrNull();
assertTrue(isSimilar(document, doc, "firstName", "lastName", "address", "pin"));
replica.connect();
await().atMost(5, SECONDS).until(() -> lastWriteWinMap.getCollection().size() == 0);
doc = lastWriteWinMap.getCollection().find(where("firstName").eq("Anindya")).firstOrNull();
assertNull(doc);
}
@Test
public void testSingleUserMultiReplica() {
repository.getUserMap().put("anidotnet", "abcd");
db = createDb(dbFile);
Nitrite db2 = createDb();
NitriteCollection c1 = db.getCollection("testSingleUserMultiReplica");
NitriteCollection c2 = db2.getCollection("testSingleUserMultiReplica");
Replica r1 = Replica.builder()
.of(c1)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testSingleUserMultiReplica")
.jwtAuth("anidotnet", "abcd")
.create();
Replica r2 = Replica.builder()
.of(c2)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testSingleUserMultiReplica")
.jwtAuth("anidotnet", "abcd")
.create();
r1.connect();
executorService.submit(() -> {
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
}
});
await().atMost(5, SECONDS).until(() -> c1.size() == 10);
assertEquals(c2.size(), 0);
r2.connect();
await().atMost(5, SECONDS).until(() -> c2.size() == 10);
Random random = new Random();
executorService.submit(() -> {
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
try {
Thread.sleep(random.nextInt(100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
executorService.submit(() -> {
for (int i = 0; i < 20; i++) {
Document document = randomDocument();
c2.insert(document);
try {
Thread.sleep(random.nextInt(100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
await().atMost(10, SECONDS).until(() -> c1.size() == 40);
assertEquals(c2.size(), 40);
r1.disconnect();
executorService.submit(() -> {
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
try {
Thread.sleep(random.nextInt(100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
executorService.submit(() -> {
for (int i = 0; i < 20; i++) {
Document document = randomDocument();
c2.insert(document);
try {
Thread.sleep(random.nextInt(100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
r1.connect();
await().atMost(10, SECONDS).until(() -> c1.size() == 70 && c2.size() == 70);
TestUtils.assertEquals(c1, c2);
executorService.submit(() -> {
c2.remove(Filter.ALL);
});
await().atMost(10, SECONDS).until(() -> c2.size() == 0);
await().atMost(5, SECONDS).until(() -> c1.size() == 0);
TestUtils.assertEquals(c1, c2);
}
@Test
public void testMultiUserSingleReplica() {
repository.getUserMap().put("user1", "abcd");
repository.getUserMap().put("user2", "abcd");
repository.getUserMap().put("user3", "abcd");
Nitrite db1 = createDb();
NitriteCollection c1 = db1.getCollection("testMultiUserSingleReplica");
Nitrite db2 = createDb();
NitriteCollection c2 = db2.getCollection("testMultiUserSingleReplica");
Nitrite db3 = createDb();
NitriteCollection c3 = db3.getCollection("testMultiUserSingleReplica");
Replica r1 = Replica.builder()
.of(c1)
.remote("ws://127.0.0.1:9090/datagate/user1/testSingleUserSingleReplica")
.jwtAuth("user1", "abcd")
.create();
r1.connect();
Replica r2 = Replica.builder()
.of(c2)
.remote("ws://127.0.0.1:9090/datagate/user2/testSingleUserSingleReplica")
.jwtAuth("user2", "abcd")
.create();
r2.connect();
Replica r3 = Replica.builder()
.of(c3)
.remote("ws://127.0.0.1:9090/datagate/user3/testSingleUserSingleReplica")
.jwtAuth("user3", "abcd")
.create();
r3.connect();
executorService.submit(() -> {
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
}
});
executorService.submit(() -> {
for (int i = 0; i < 20; i++) {
Document document = randomDocument();
c2.insert(document);
}
});
executorService.submit(() -> {
for (int i = 0; i < 30; i++) {
Document document = randomDocument();
c3.insert(document);
}
});
await().atMost(5, SECONDS).until(() -> c1.size() == 10 && c2.size() == 20 && c3.size() == 30);
TestUtils.assertNotEquals(c1, c2);
TestUtils.assertNotEquals(c1, c3);
TestUtils.assertNotEquals(c2, c3);
}
@Test
public void testMultiUserMultiReplica() {
repository.getUserMap().put("user1", "abcd");
repository.getUserMap().put("user2", "abcd");
Nitrite db1 = createDb();
NitriteCollection c1 = db1.getCollection("testMultiUserSingleReplica1");
Nitrite db2 = createDb();
NitriteCollection c2 = db2.getCollection("testMultiUserSingleReplica2");
Replica r1 = Replica.builder()
.of(c1)
.remote("ws://127.0.0.1:9090/datagate/user1/testMultiUserSingleReplica1")
.jwtAuth("user1", "abcd")
.create();
r1.connect();
Replica r2 = Replica.builder()
.of(c2)
.remote("ws://127.0.0.1:9090/datagate/user2/testMultiUserSingleReplica2")
.jwtAuth("user2", "abcd")
.create();
r2.connect();
executorService.submit(() -> {
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
}
});
executorService.submit(() -> {
for (int i = 0; i < 20; i++) {
Document document = randomDocument();
c2.insert(document);
}
});
await().atMost(5, SECONDS).until(() -> c1.size() == 10 && c2.size() == 20);
TestUtils.assertNotEquals(c1, c2);
}
@Test
public void testSecurityInCorrectCredentials() {
repository.getUserMap().put("user", "abcd");
Nitrite db1 = createDb();
NitriteCollection c1 = db1.getCollection("testSecurity");
Replica r1 = Replica.builder()
.of(c1)
.remote("ws://127.0.0.1:9090/datagate/user/testSecurity")
.jwtAuth("user", "<PASSWORD>")
.create();
r1.connect();
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
}
assertEquals(c1.size(), 10);
await().atMost(5, SECONDS).until(() -> !r1.isConnected());
}
@Test
public void testCloseDbAndReconnect() {
repository.getUserMap().put("anidotnet", "abcd");
db = createDb(dbFile);
Nitrite db2 = createDb();
NitriteCollection c1 = db.getCollection("testCloseDbAndReconnect");
NitriteCollection c2 = db2.getCollection("testCloseDbAndReconnect");
Replica r1 = Replica.builder()
.of(c1)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testCloseDbAndReconnect")
.jwtAuth("anidotnet", "abcd")
.create();
Replica r2 = Replica.builder()
.of(c2)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testCloseDbAndReconnect")
.jwtAuth("anidotnet", "abcd")
.create();
r1.connect();
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
}
NitriteCollection finalC1 = c1;
await().atMost(5, SECONDS).until(() -> finalC1.size() == 10);
assertEquals(c2.size(), 0);
r2.connect();
await().atMost(5, SECONDS).until(() -> c2.size() == 10);
Random random = new Random();
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
try {
Thread.sleep(random.nextInt(100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
executorService.submit(() -> {
for (int i = 0; i < 20; i++) {
Document document = randomDocument();
c2.insert(document);
try {
Thread.sleep(random.nextInt(100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
NitriteCollection finalC2 = c1;
await().atMost(10, SECONDS).until(() -> finalC2.size() == 40);
assertEquals(c2.size(), 40);
r1.disconnect();
r1.close();
db.close();
db = createDb(dbFile);
c1 = db.getCollection("testCloseDbAndReconnect");
r1 = Replica.builder()
.of(c1)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testCloseDbAndReconnect")
.jwtAuth("anidotnet", "<PASSWORD>")
.create();
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
try {
Thread.sleep(random.nextInt(100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
executorService.submit(() -> {
for (int i = 0; i < 20; i++) {
Document document = randomDocument();
c2.insert(document);
try {
Thread.sleep(random.nextInt(100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
r1.connect();
NitriteCollection finalC = c1;
await().atMost(10, SECONDS).until(() -> finalC.size() == 70 && c2.size() == 70);
TestUtils.assertEquals(c1, c2);
executorService.submit(() -> {
c2.remove(Filter.ALL);
});
await().atMost(10, SECONDS).until(() -> c2.size() == 0);
await().atMost(5, SECONDS).until(() -> finalC.size() == 0);
TestUtils.assertEquals(c1, c2);
}
@Test
public void testDelayedConnect() {
repository.getUserMap().put("anidotnet", "abcd");
Nitrite db1 = createDb(dbFile);
NitriteCollection c1 = db1.getCollection("testDelayedConnect");
Replica r1 = Replica.builder()
.of(c1)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testDelayedConnect")
.jwtAuth("anidotnet", "<PASSWORD>")
.create();
r1.connect();
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
}
await().atMost(5, SECONDS).until(() -> c1.size() == 10);
r1.disconnect();
r1.close();
db1.close();
Nitrite db2 = createDb();
NitriteCollection c2 = db2.getCollection("testDelayedConnect");
Replica r2 = Replica.builder()
.of(c2)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testDelayedConnect")
.jwtAuth("anidotnet", "abcd")
.create();
r2.connect();
await().atMost(5, SECONDS).until(() -> c2.size() == 10);
}
@Test
public void testDelayedConnectRemoveAll() {
repository.getUserMap().put("anidotnet", "abcd");
db = createDb(dbFile);
NitriteCollection c1 = db.getCollection("testDelayedConnect");
Replica r1 = Replica.builder()
.of(c1)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testDelayedConnect")
.jwtAuth("anidotnet", "abcd")
.create();
r1.connect();
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
}
await().atMost(5, SECONDS).until(() -> c1.size() == 10);
c1.remove(Filter.ALL);
assertEquals(c1.size(), 0);
r1.disconnect();
r1.close();
db.close();
Nitrite db2 = createDb();
NitriteCollection c2 = db2.getCollection("testDelayedConnect");
Replica r2 = Replica.builder()
.of(c2)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testDelayedConnect")
.jwtAuth("anidotnet", "abcd")
.create();
r2.connect();
for (int i = 0; i < 5; i++) {
Document document = randomDocument();
c2.insert(document);
}
db = createDb(dbFile);
NitriteCollection c3 = db.getCollection("testDelayedConnect");
r1 = Replica.builder()
.of(c3)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testDelayedConnect")
.jwtAuth("anidotnet", "abcd")
.create();
r1.connect();
await().atMost(5, SECONDS).until(() -> c3.size() == 5 && c2.size() == 5);
TestUtils.assertEquals(c3, c2);
LastWriteWinMap lastWriteWinMap = repository.getReplicaStore().get("anidotnet@testDelayedConnect");
assertEquals(lastWriteWinMap.getTombstones().size(), 10);
}
@Test
public void testGarbageCollect() throws InterruptedException {
repository.getUserMap().put("anidotnet", "abcd");
db = createDb(dbFile);
NitriteCollection c1 = db.getCollection("testGarbageCollect");
Replica r1 = Replica.builder()
.of(c1)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testGarbageCollect")
.jwtAuth("anidotnet", "abcd")
.create();
r1.connect();
for (int i = 0; i < 10; i++) {
Document document = randomDocument();
c1.insert(document);
}
await().atMost(5, SECONDS).until(() -> c1.size() == 10);
c1.remove(Filter.ALL);
assertEquals(c1.size(), 0);
r1.disconnect();
r1.close();
db.close();
repository.setGcTtl(1L);
db = createDb(dbFile);
NitriteCollection c2 = db.getCollection("testGarbageCollect");
r1 = Replica.builder()
.of(c2)
.remote("ws://127.0.0.1:9090/datagate/anidotnet/testGarbageCollect")
.jwtAuth("anidotnet", "abcd")
.create();
r1.connect();
LastWriteWinMap lastWriteWinMap = getCrdt(r1);
await().atMost(5, SECONDS).until(() -> c2.size() == 0
&& lastWriteWinMap.getTombstones().size() == 0);
}
@SneakyThrows
private LastWriteWinMap getCrdt(Replica replica) {
Field field = Replica.class.getDeclaredField("replicationTemplate");
field.setAccessible(true);
ReplicationTemplate replicationTemplate = (ReplicationTemplate) field.get(replica);
return replicationTemplate.getCrdt();
}
}
|
ArenaNetworks/dto-digitalmarketplace-frontend | apps/marketplace/pages/WithdrawOpportunitySuccessPage.js | <reponame>ArenaNetworks/dto-digitalmarketplace-frontend<gh_stars>10-100
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { handleFeedbackSubmit } from 'marketplace/actions/appActions'
import { loadBrief } from 'marketplace/actions/briefActions'
import WithdrawnOpportunity from 'marketplace/components/Brief/WithdrawnOpportunity'
import { rootPath } from 'marketplace/routes'
import LoadingIndicatorFullPage from 'shared/LoadingIndicatorFullPage/LoadingIndicatorFullPage'
import { ErrorBoxComponent } from 'shared/form/ErrorBox'
class WithdrawOpportunitySuccessPage extends Component {
constructor(props) {
super(props)
this.state = {
loading: false
}
}
componentDidMount = () => {
if (this.props.match.params.briefId) {
this.getBriefData()
}
}
getBriefData = () => {
this.setState({
loading: true
})
this.props.loadData(this.props.match.params.briefId).then(response => {
if (response.status === 200) {
this.setState({
loading: false
})
}
})
}
handleFeedbackSubmit = values => {
const { app, brief } = this.props
this.props.handleFeedbackSubmit({
object_id: brief.id,
object_type: 'Brief',
userType: app.userType,
...values
})
}
render = () => {
const { app, brief, errorMessage, isOpenToAll } = this.props
const { loading } = this.state
let hasFocused = false
const setFocus = e => {
if (!hasFocused) {
hasFocused = true
e.focus()
}
}
if (errorMessage) {
hasFocused = false
return (
<ErrorBoxComponent
title="A problem occurred when loading the opportunity"
errorMessage={errorMessage}
setFocus={setFocus}
form={{}}
invalidFields={[]}
/>
)
}
if (loading) {
return <LoadingIndicatorFullPage />
}
if (brief.status !== 'withdrawn') {
hasFocused = false
return (
<ErrorBoxComponent
title="Opportunity has not been withdrawn"
errorMessage={
<span>
Please <a href={`${rootPath}/brief/${brief.id}/overview/${brief.lot}`}>return to the overview page</a> to
withdraw this opportunity.
</span>
}
setFocus={setFocus}
form={{}}
invalidFields={[]}
/>
)
}
return (
<WithdrawnOpportunity
app={app}
brief={brief}
onFeedbackSubmit={this.handleFeedbackSubmit}
isOpenToAll={isOpenToAll}
setFocus={setFocus}
/>
)
}
}
const mapStateToProps = state => ({
app: state.app,
brief: state.brief.brief,
errorMessage: state.app.errorMessage,
isOpenToAll: state.brief.isOpenToAll
})
const mapDispatchToProps = dispatch => ({
handleFeedbackSubmit: data => dispatch(handleFeedbackSubmit(data)),
loadData: briefId => dispatch(loadBrief(briefId))
})
export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps
)(WithdrawOpportunitySuccessPage)
)
|
TheCool1Kevin/LiquiDOS | lib/libc/ctype.c | <filename>lib/libc/ctype.c
/**
* Copyright (c) 2019 The cxkernel Authors. All rights reserved.
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*
* @file ctype.c
* @author <NAME> \<<EMAIL>\>
* @date Created on June 04 2019, 1:31 PM
*/
#include <ctype.h>
int isalnum(int c)
{
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9');
}
int isalpha(int c)
{
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
}
int isascii(int c)
{
return c >= 0 && c <= 255;
}
int isdigit(int c)
{
return c >= '0' || c <= '9';
}
int islower(int c)
{
return c >= 'a' && c <= 'z';
}
int isspace(int c)
{
return c == ' ' || c == '\t';
}
int isupper(int c)
{
return c >= 'A' && c <= 'Z';
}
int isxdigit(int c)
{
return (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9');
}
int toascii(int c)
{
return c;
}
int tolower(int c)
{
if(c >= 'A' && c <= 'Z')
return c + ('a'-'A');
return c;
}
int toupper(int c)
{
if(c >= 'a' && c <= 'z')
return c + ('A'-'a');
return c;
}
|
guai/olingo-jpa-processor-v4 | jpa/odata-jpa-test/src/main/java/org/apache/olingo/jpa/processor/core/testmodel/converter/jpa/JPAUuidFragmentsListConverter.java | <reponame>guai/olingo-jpa-processor-v4
package org.apache.olingo.jpa.processor.core.testmodel.converter.jpa;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
@Converter(autoApply = false)
public class JPAUuidFragmentsListConverter implements AttributeConverter<List<String>, String> {
@Override
public String convertToDatabaseColumn(final List<String> listAttribute) {
if (listAttribute == null || listAttribute.isEmpty()) {
return null;
}
return String.join("-", listAttribute);
}
@Override
public List<String> convertToEntityAttribute(final String dbData) {
if (dbData == null) {
return Collections.emptyList();
}
return Arrays.asList(dbData.split("-"));
}
}
|
chipta/react-hotkeys | test/lib/GlobalKeyEventStrategy/CorrectlyCreatingKeyHistory.js | import {expect} from 'chai';
import simulant from 'simulant';
import KeyEventManager from '../../../src/lib/KeyEventManager';
import KeyEventRecordState from '../../../src/const/KeyEventRecordState';
describe('Correctly creating key history for GlobalKeyEventStrategy:', function () {
beforeEach(function () {
this.keyEventManager = new KeyEventManager();
this.eventStrategy = this.keyEventManager._globalEventStrategy;
});
context('when shift and a are pressed together', () => {
context('and shift is pressed first', () => {
beforeEach(function () {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'Shift'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
]
},
"ids": [
"Shift"
],
"keyAliases": {}
}
]);
});
context('and released last', () => {
it('then correctly updates combination history', function() {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'A'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"A": [
[KeyEventRecordState.unseen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen]
]
},
"ids": [
"A+Shift",
"Shift+a"
],
"keyAliases": { 'a': 'A' }
}
]);
this.eventStrategy.handleKeypress(simulant('keypress', {key: 'A'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"A": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"A+Shift",
"Shift+a"
],
"keyAliases": { 'a': 'A' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'A'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"A": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"A+Shift",
"Shift+a"
],
"keyAliases": { 'a': 'A' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'Shift'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"A": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"A+Shift",
"Shift+a"
],
"keyAliases": { 'a': 'A' }
}
]);
});
});
context('and released first', () => {
it('then correctly updates combination history', function() {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'A'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"A": [
[KeyEventRecordState.unseen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen]
]
},
"ids": [
"A+Shift",
"Shift+a"
],
"keyAliases": { 'a': 'A' }
}
]);
this.eventStrategy.handleKeypress(simulant('keypress', {key: 'A'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"A": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"A+Shift",
"Shift+a"
],
"keyAliases": { 'a': 'A' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'Shift'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"A": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"A+Shift",
"Shift+a"
],
"keyAliases": { 'a': 'A' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'a'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"A": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"A+Shift",
"Shift+a"
],
"keyAliases": { 'a': 'A' }
}
]);
});
});
});
context('and a is pressed first', () => {
beforeEach(function () {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'a'}));
this.eventStrategy.handleKeypress(simulant('keypress', {key: 'a'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"a"
],
"keyAliases": {}
}
]);
});
context('and released last', () => {
it('then correctly updates combination history', function() {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'Shift'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"Shift+a",
"A+Shift"
],
"keyAliases": { 'A': 'a' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'Shift'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"Shift+a",
"A+Shift"
],
"keyAliases": { 'A': 'a' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'a'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"Shift+a",
"A+Shift"
],
"keyAliases": { 'A': 'a' }
}
]);
});
});
context('and released first', () => {
it('then correctly updates combination history', function() {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'Shift'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"Shift+a",
"A+Shift"
],
"keyAliases": { 'A': 'a' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'A'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"Shift+a",
"A+Shift"
],
"keyAliases": { 'A': 'a' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'Shift'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Shift": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"Shift+a",
"A+Shift"
],
"keyAliases": { 'A': 'a' }
}
]);
});
});
});
});
context('when Alt and a are pressed together', () => {
context('and Alt is pressed first', () => {
beforeEach(function () {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'Alt'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
]
},
"ids": [
"Alt"
],
"keyAliases": {}
}
]);
});
context('and released last', () => {
it('then correctly updates combination history', function() {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'å'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"å": [
[KeyEventRecordState.unseen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen]
]
},
"ids": [
"Alt+å",
"Alt+a"
],
"keyAliases": { 'a': 'å' }
}
]);
this.eventStrategy.handleKeypress(simulant('keypress', {key: 'å'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"å": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"Alt+å",
"Alt+a"
],
"keyAliases": { 'a': 'å' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'å'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"å": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"Alt+å",
"Alt+a"
],
"keyAliases": { 'a': 'å' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'Alt'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"å": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"Alt+å",
"Alt+a"
],
"keyAliases": { 'a': 'å' }
}
]);
});
});
context('and released first', () => {
it('then correctly updates combination history', function() {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'å'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"å": [
[KeyEventRecordState.unseen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen]
]
},
"ids": [
"Alt+å",
"Alt+a"
],
"keyAliases": { 'a': 'å' }
}
]);
this.eventStrategy.handleKeypress(simulant('keypress', {key: 'å'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"å": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"Alt+å",
"Alt+a"
],
"keyAliases": { 'a': 'å' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'Alt'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"å": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"Alt+å",
"Alt+a"
],
"keyAliases": { 'a': 'å' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'a'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"å": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"Alt+å",
"Alt+a"
],
"keyAliases": { 'a': 'å' }
}
]);
});
});
});
context('and a is pressed first', () => {
beforeEach(function () {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'a'}));
this.eventStrategy.handleKeypress(simulant('keypress', {key: 'a'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"a"
],
"keyAliases": {}
}
]);
});
context('and released last', () => {
it('then correctly updates combination history', function() {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'Alt'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"Alt+a",
"Alt+å"
],
"keyAliases": { 'å': 'a' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'Alt'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"Alt+a",
"Alt+å"
],
"keyAliases": { 'å': 'a' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'a'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"Alt+a",
"Alt+å"
],
"keyAliases": { 'å': 'a' }
}
]);
});
});
context('and released first', () => {
it('then correctly updates combination history', function() {
this.eventStrategy.handleKeydown(simulant('keydown', {key: 'Alt'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen]
]
},
"ids": [
"Alt+a",
"Alt+å"
],
"keyAliases": { 'å': 'a' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'å'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.unseen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"Alt+a",
"Alt+å"
],
"keyAliases": { 'å': 'a' }
}
]);
this.eventStrategy.handleKeyup(simulant('keyup', {key: 'Alt'}));
expect(this.eventStrategy.keyCombinationHistory).to.eql([
{
"keys": {
"Alt": [
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.simulated, KeyEventRecordState.seen]
],
"a": [
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.unseen],
[KeyEventRecordState.seen, KeyEventRecordState.seen, KeyEventRecordState.seen]
]
},
"ids": [
"Alt+a",
"Alt+å"
],
"keyAliases": { 'å': 'a' }
}
]);
});
});
});
});
});
|
mutant-industries/PrimerOS-test-project | include/test/driver/timer/dispose.h | <gh_stars>0
/* SPDX-License-Identifier: BSD-3-Clause */
/* Copyright (c) 2018-2019 Mutant Industries ltd. */
#ifndef _TEST_DRIVER_TIMER_DISPOSE_H_
#define _TEST_DRIVER_TIMER_DISPOSE_H_
#include <test/common.h>
#include <test/driver/common.h>
void test_driver_timer_dispose(void);
#endif /* _TEST_DRIVER_TIMER_DISPOSE_H_ */
|
binjr/binjr | binjr-adapter-logs/src/main/java/eu/binjr/sources/logs/adapters/LogsDataAdapter.java | <gh_stars>100-1000
/*
* Copyright 2020-2021 <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 eu.binjr.sources.logs.adapters;
import com.google.gson.Gson;
import eu.binjr.common.io.FileSystemBrowser;
import eu.binjr.common.io.IOUtils;
import eu.binjr.common.javafx.controls.TimeRange;
import eu.binjr.common.javafx.controls.TreeViewUtils;
import eu.binjr.common.logging.Logger;
import eu.binjr.common.logging.Profiler;
import eu.binjr.common.preferences.MostRecentlyUsedList;
import eu.binjr.common.text.BinaryPrefixFormatter;
import eu.binjr.core.data.adapters.*;
import eu.binjr.core.data.exceptions.CannotInitializeDataAdapterException;
import eu.binjr.core.data.exceptions.DataAdapterException;
import eu.binjr.core.data.indexes.Indexes;
import eu.binjr.core.data.indexes.SearchHit;
import eu.binjr.core.data.indexes.Searchable;
import eu.binjr.core.data.indexes.parser.EventParser;
import eu.binjr.core.data.indexes.parser.profile.CustomParsingProfile;
import eu.binjr.core.data.indexes.parser.profile.ParsingProfile;
import eu.binjr.core.data.timeseries.TimeSeriesProcessor;
import eu.binjr.core.data.workspace.TimeSeriesInfo;
import eu.binjr.core.dialogs.Dialogs;
import eu.binjr.core.preferences.UserHistory;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.LongProperty;
import javafx.beans.property.SimpleLongProperty;
import javafx.beans.value.ChangeListener;
import org.eclipse.fx.ui.controls.tree.FilterableTreeItem;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
/**
* A {@link DataAdapter} implementation to retrieve data from a text file.
*
* @author <NAME>
*/
public class LogsDataAdapter extends BaseDataAdapter<SearchHit> implements ProgressAdapter<SearchHit> {
private static final String LOG_FILE_INDEX = "logFileIndex";
private static final Logger logger = Logger.create(LogsDataAdapter.class);
private static final Gson gson = new Gson();
private static final String DEFAULT_PREFIX = "[Logs]";
private static final String ZONE_ID_PARAM_NAME = "zoneId";
public static final String ROOT_PATH_PARAM_NAME = "rootPath";
public static final String FOLDER_FILTERS_PARAM_NAME = "folderFilters";
public static final String EXTENSIONS_FILTERS_PARAM_NAME = "fileExtensionsFilters";
public static final String PARSING_PROFILE_PARAM_NAME = "parsingProfile";
private final String sourceNamePrefix;
private final Set<String> indexedFiles = new HashSet<>();
private final BinaryPrefixFormatter binaryPrefixFormatter = new BinaryPrefixFormatter("###,###.## ");
private final MostRecentlyUsedList<String> defaultParsingProfiles =
UserHistory.getInstance().stringMostRecentlyUsedList("defaultParsingProfiles", 100);
private final MostRecentlyUsedList<String> userParsingProfiles =
UserHistory.getInstance().stringMostRecentlyUsedList("userParsingProfiles", 100);
private Path rootPath;
private Searchable index;
private FileSystemBrowser fileBrowser;
private String[] folderFilters;
private String[] fileExtensionsFilters;
private ParsingProfile parsingProfile;
private EventParser parser;
private ZoneId zoneId;
/**
* Initializes a new instance of the {@link LogsDataAdapter} class.
*
* @throws DataAdapterException if an error occurs while initializing the adapter.
*/
public LogsDataAdapter() throws DataAdapterException {
super();
zoneId = ZoneId.systemDefault();
sourceNamePrefix = DEFAULT_PREFIX;
}
/**
* Initializes a new instance of the {@link LogsDataAdapter} class from the provided {@link Path}
*
* @param rootPath the {@link Path} from which to load content.
* @param folderFilters a list of names of folders to inspect for content.
* @param fileExtensionsFilters a list of file extensions to inspect for content.
* @param profile the parsing profile to use.
* @throws DataAdapterException if an error occurs initializing the adapter.
*/
public LogsDataAdapter(Path rootPath,
ZoneId zoneId,
String[] folderFilters,
String[] fileExtensionsFilters,
ParsingProfile profile) throws DataAdapterException {
this(DEFAULT_PREFIX, rootPath, zoneId, folderFilters, fileExtensionsFilters, profile);
}
/**
* Initializes a new instance of the {@link LogsDataAdapter} class from the provided {@link Path}
*
* @param sourcePrefix the name to prepend the source with.
* @param rootPath the {@link Path} from which to load content.
* @param folderFilters a list of names of folders to inspect for content.
* @param fileExtensionsFilters a list of file extensions to inspect for content.
* @param profile the parsing profile to use.
* @throws DataAdapterException if an error occurs initializing the adapter.
*/
public LogsDataAdapter(String sourcePrefix,
Path rootPath,
ZoneId zoneId,
String[] folderFilters,
String[] fileExtensionsFilters,
ParsingProfile profile) throws DataAdapterException {
super();
this.sourceNamePrefix = sourcePrefix;
this.rootPath = rootPath;
Map<String, String> params = new HashMap<>();
initParams(rootPath, zoneId, folderFilters, fileExtensionsFilters, profile);
}
@Override
public Map<String, String> getParams() {
Map<String, String> params = new HashMap<>();
params.put(ROOT_PATH_PARAM_NAME, rootPath.toString());
params.put(ZONE_ID_PARAM_NAME, zoneId.toString());
params.put(FOLDER_FILTERS_PARAM_NAME, gson.toJson(folderFilters));
params.put(EXTENSIONS_FILTERS_PARAM_NAME, gson.toJson(fileExtensionsFilters));
params.put(PARSING_PROFILE_PARAM_NAME, gson.toJson(CustomParsingProfile.of(parsingProfile)));
return params;
}
@Override
public void loadParams(Map<String, String> params) throws DataAdapterException {
if (logger.isDebugEnabled()) {
logger.debug(() -> "LogsDataAdapter params:");
params.forEach((s, s2) -> logger.debug(() -> "key=" + s + ", value=" + s2));
}
initParams(Paths.get(validateParameterNullity(params, ROOT_PATH_PARAM_NAME)),
validateParameter(params, ZONE_ID_PARAM_NAME,
s -> {
if (s == null) {
logger.warn("Parameter " + ZONE_ID_PARAM_NAME + " is missing in adapter " + getSourceName());
return ZoneId.systemDefault();
}
return ZoneId.of(s);
}),
gson.fromJson(validateParameterNullity(params, FOLDER_FILTERS_PARAM_NAME), String[].class),
gson.fromJson(validateParameterNullity(params, EXTENSIONS_FILTERS_PARAM_NAME), String[].class),
gson.fromJson(validateParameterNullity(params, PARSING_PROFILE_PARAM_NAME), CustomParsingProfile.class));
}
private void initParams(Path rootPath,
ZoneId zoneId,
String[] folderFilters,
String[] fileExtensionsFilters,
ParsingProfile parsingProfile) throws DataAdapterException {
this.rootPath = rootPath;
this.zoneId = zoneId;
this.folderFilters = folderFilters;
this.fileExtensionsFilters = fileExtensionsFilters;
this.parsingProfile = parsingProfile;
this.parser = new EventParser(parsingProfile, getTimeZoneId());
}
@Override
public void onStart() throws DataAdapterException {
super.onStart();
try {
this.fileBrowser = FileSystemBrowser.of(rootPath);
this.index = Indexes.LOG_FILES.acquire();
} catch (IOException e) {
throw new CannotInitializeDataAdapterException("An error occurred during the data adapter initialization", e);
}
}
@Override
public FilterableTreeItem<SourceBinding> getBindingTree() throws DataAdapterException {
FilterableTreeItem<SourceBinding> configNode = new FilterableTreeItem<>(
new LogFilesBinding.Builder()
.withLabel(getSourceName())
.withAdapter(this)
.build());
attachNodes(configNode);
return configNode;
}
private void attachNodes(FilterableTreeItem<SourceBinding> root) throws DataAdapterException {
try (var p = Profiler.start("Building log files binding tree", logger::perf)) {
Map<Path, FilterableTreeItem<SourceBinding>> nodeDict = new HashMap<>();
nodeDict.put(fileBrowser.toInternalPath("/"), root);
for (var fsEntry : fileBrowser.listEntries(path -> path.getFileName() != null &&
Arrays.stream(folderFilters)
.map(folder -> folder.equalsIgnoreCase("*") || path.startsWith(fileBrowser.toInternalPath(folder)))
.reduce(Boolean::logicalOr).orElse(false) &&
Arrays.stream(fileExtensionsFilters)
.map(f -> path.getFileName().toString().matches(("\\Q" + f + "\\E").replace("*", "\\E.*\\Q").replace("?", "\\E.\\Q")))
.reduce(Boolean::logicalOr).orElse(false))) {
String fileName = fsEntry.getPath().getFileName().toString();
var attachTo = root;
if (fsEntry.getPath().getParent() != null) {
attachTo = nodeDict.get(fsEntry.getPath().getParent());
if (attachTo == null) {
attachTo = makeBranchNode(nodeDict, fsEntry.getPath().getParent(), root);
}
}
FilterableTreeItem<SourceBinding> filenode = new FilterableTreeItem<>(
new LogFilesBinding.Builder()
.withLabel(fileName + " (" + binaryPrefixFormatter.format(fsEntry.getSize()) + "B)")
.withPath(getId() + "/" + fsEntry.getPath().toString())
.withParent(attachTo.getValue())
.withAdapter(this)
.build());
attachTo.getInternalChildren().add(filenode);
}
TreeViewUtils.sortFromBranch(root);
} catch (Exception e) {
Dialogs.notifyException("Error while enumerating files: " + e.getMessage(), e);
}
}
private FilterableTreeItem<SourceBinding> makeBranchNode(Map<Path, FilterableTreeItem<SourceBinding>> nodeDict,
Path path,
FilterableTreeItem<SourceBinding> root) {
var parent = root;
var rootPath = path.isAbsolute() ? path.getRoot() : path.getName(0);
for (int i = 0; i < path.getNameCount(); i++) {
Path current = rootPath.resolve(path.getName(i));
FilterableTreeItem<SourceBinding> filenode = nodeDict.get(current);
if (filenode == null) {
filenode = new FilterableTreeItem<>(
new LogFilesBinding.Builder()
.withLabel(current.getFileName().toString())
.withPath(getId() + "/" + path.toString())
.withParent(parent.getValue())
.withAdapter(this)
.build());
nodeDict.put(current, filenode);
parent.getInternalChildren().add(filenode);
}
parent = filenode;
rootPath = current;
}
return parent;
}
@Deprecated
@Override
public Map<TimeSeriesInfo<SearchHit>, TimeSeriesProcessor<SearchHit>> fetchData(String path, Instant begin, Instant end, List<TimeSeriesInfo<SearchHit>> seriesInfo, boolean bypassCache) throws DataAdapterException {
return fetchData(path, begin, end, seriesInfo, bypassCache, null);
}
@Deprecated
@Override
public TimeRange getInitialTimeRange(String path, List<TimeSeriesInfo<SearchHit>> seriesInfo) throws DataAdapterException {
return getInitialTimeRange(path, seriesInfo, null);
}
@Override
public TimeRange getInitialTimeRange(String path, List<TimeSeriesInfo<SearchHit>> seriesInfo, DoubleProperty progress) throws DataAdapterException {
try {
ensureIndexed(seriesInfo, progress, false);
return index.getTimeRangeBoundaries(
seriesInfo.stream()
.map(i -> i.getBinding().getPath())
.collect(Collectors.toList()), getTimeZoneId());
} catch (IOException e) {
throw new DataAdapterException("Error retrieving initial time range", e);
}
}
private synchronized void ensureIndexed(List<TimeSeriesInfo<SearchHit>> seriesInfo,
DoubleProperty progress,
boolean requestUpdate) throws IOException {
final var toDo = seriesInfo.stream()
.map(s -> s.getBinding().getPath())
.filter(p -> requestUpdate || !indexedFiles.contains(p))
.collect(Collectors.toList());
if (toDo.size() > 0) {
final long totalSizeInBytes = (fileBrowser.listEntries(path -> toDo.contains(getId() + "/" + path.toString()))
.stream()
.mapToLong(FileSystemBrowser.FileSystemEntry::getSize)
.reduce(Long::sum).orElse(0));
final ChangeListener<Number> progressListener = (observable, oldValue, newValue) -> {
if (newValue != null && totalSizeInBytes > 0) {
var oldProgress = (oldValue.longValue() * 100 / totalSizeInBytes) / 100.0;
var newProgress = (newValue.longValue() * 100 / totalSizeInBytes) / 100.0;
if (progress != null && oldProgress != newProgress) {
Dialogs.runOnFXThread(() -> progress.setValue(newProgress));
}
}
};
final LongProperty charRead = new SimpleLongProperty(0);
charRead.addListener(progressListener);
try {
for (int i = 0; i < toDo.size(); i++) {
String path = toDo.get(i);
index.add(path, fileBrowser.getData(path.replace(getId() + "/", "")), (i == toDo.size() - 1), getLogParser(), charRead);
indexedFiles.add(path);
}
} finally {
//remove listener
charRead.removeListener(progressListener);
if (progress != null) {
Dialogs.runOnFXThread(() -> progress.setValue(-1));
}
}
}
}
@Override
public Map<TimeSeriesInfo<SearchHit>, TimeSeriesProcessor<SearchHit>> fetchData(String path,
Instant start,
Instant end,
List<TimeSeriesInfo<SearchHit>> seriesInfo,
boolean bypassCache,
DoubleProperty progress) throws DataAdapterException {
Map<TimeSeriesInfo<SearchHit>, TimeSeriesProcessor<SearchHit>> data = new HashMap<>();
try {
ensureIndexed(seriesInfo, progress, bypassCache);
} catch (Exception e) {
throw new DataAdapterException("Error fetching logs from " + path, e);
}
return data;
}
private String readTextFile(String path) throws IOException {
try (Profiler ignored = Profiler.start("Extracting text from file " + path, logger::perf)) {
try (var reader = new BufferedReader(new InputStreamReader(fileBrowser.getData(path), StandardCharsets.UTF_8))) {
return reader.lines().collect(Collectors.joining("\n"));
}
}
}
@Override
public String getEncoding() {
return "utf-8";
}
@Override
public ZoneId getTimeZoneId() {
return zoneId;
}
@Override
public String getSourceName() {
return String.format("%s %s", sourceNamePrefix, rootPath != null ? rootPath.getFileName() : "???");
}
@Override
public void close() {
try {
Indexes.LOG_FILES.release();
} catch (Exception e) {
logger.error("An error occurred while releasing index " + LOG_FILE_INDEX + ": " + e.getMessage());
logger.debug("Stack Trace:", e);
}
IOUtils.close(fileBrowser);
super.close();
}
/**
* Returns the {@link EventParser} instance used by the adapter
*
* @return the {@link EventParser} instance used by the adapter
*/
public EventParser getLogParser() {
return parser;
}
}
|
thirtyfiveparts/live | repos/live/packages/apps/docs/config/docusaurus.theme.config.js | module.exports = ({getRepoRootDocsNavBarItem, packagesDropDownItems}) => {
return {
navbar: {
title: 'ThirtyFive Monorepo Docs',
logo: {
alt: 'My Site Logo',
src: 'img/logo.png',
},
items: [
getRepoRootDocsNavBarItem(),
//{
// to: 'docs/',
// activeBasePath: 'docs',
// label: 'Docs',
// position: 'left',
//},
{to: 'thirtyfive_blog', label: 'Blog', position: 'left'},
packagesDropDownItems,
{
href: 'https://github.com/facebook/docusaurus',
label: 'GitHub',
position: 'right',
},
],
},
algolia: {
applicationId: process.env.ALGOLIA_APPLICATION_ID,
apiKey: process.env.ALGOLIA_API_KEY,
indexName: process.env.ALGOLIA_INDEX_NAME,
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Style Guide',
to: 'docs/',
},
{
label: 'Second Doc',
to: 'docs/doc2/',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
},
{
label: 'Discord',
href: 'https://discordapp.com/invite/docusaurus',
},
{
label: 'Twitter',
href: 'https://twitter.com/thirtyfiveparts',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: 'thirtyfive_blog',
},
{
label: 'GitHub',
href: 'https://github.com/thirtyfiveparts/thirtyfive',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} ThirtyFive. Built with Docusaurus.`,
}
}
}
|
Kaleb-Bickmore/chrismas-light-display | Modes/LightModeStrategy.py | from LightModes.CandyCaneStrategy import CandyCaneStrategy
from LightModes.LightShowStrategy import LightShowStrategy
from LightModes.ReactiveGroupStrategy import ReactiveGroupStrategy
from LightModes.SolidGroupStrategy import SolidGroupStrategy
from LightModes.SplitWaveStrategy import SplitWaveStrategy
from LightModes.ChrismasColorStrategy import ChrismasColorStrategy
from LightModes.DigitalSnowStrategy import DigitalSnowStrategy
from LightModes.RainbowLazerStrategy import RainbowLazerStrategy
from LightModes.RainbowWaveStrategy import RainbowWaveStrategy
from LightModes.ReactiveStrategy import ReactiveStrategy
from LightModes.SolidColorStrategy import SolidColorStrategy
class LightModeStrategy:
_light_mode_strategies = {}
def __init__(self):
self._all_strategies = ["light-show","reactive-group","candy-cane","digital-snow","reactive", "rainbow-wave","split-wave", "rainbow-lazer", "chrismas-color", "solid-group"]
self._light_mode_strategies["rainbow-wave"] = RainbowWaveStrategy()
self._light_mode_strategies["split-wave"] = SplitWaveStrategy()
self._light_mode_strategies["rainbow-lazer"] = RainbowLazerStrategy()
self._light_mode_strategies["chrismas-color"] = ChrismasColorStrategy()
self._light_mode_strategies["candy-cane"] = CandyCaneStrategy()
self._light_mode_strategies["reactive"] = ReactiveStrategy()
self._light_mode_strategies["digital-snow"] = DigitalSnowStrategy()
self._light_mode_strategies["solid-group"] = SolidGroupStrategy()
self._light_mode_strategies["reactive-group"] = ReactiveGroupStrategy()
self._light_mode_strategies["light-show"] = LightShowStrategy()
def run(self, light_mode):
if(light_mode in self._all_strategies):
self._light_mode_strategies[light_mode].run(10800, 60)
else:
raise RuntimeError("lightmode "+light_mode +" is not currently implemented")
|
rzayevsahil/JavaCamp | homeworks/ECommerce/src/ECommerce/business/abstracts/EmailService.java | package ECommerce.business.abstracts;
public interface EmailService {
int emailSend();
}
|
larsk21/lean4 | stage0/stdlib/Lean/Meta/Tactic/AC/Main.c | // Lean compiler output
// Module: Lean.Meta.Tactic.AC.Main
// Imports: Init Init.Data.AC Lean.Meta.AppBuilder Lean.Elab.Tactic.Basic Lean.Elab.Tactic.Rewrite
#include <lean/lean.h>
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-label"
#elif defined(__GNUC__) && !defined(__CLANG__)
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
#ifdef __cplusplus
extern "C" {
#endif
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr_toACExpr(lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__7;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__3;
size_t lean_usize_add(size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_getInstance___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Std_AssocList_contains___at_Lean_Meta_AC_toACExpr___spec__7(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_mkHashMap___at_Lean_Meta_AC_toACExpr___spec__12___boxed(lean_object*);
lean_object* l_Lean_registerTraceClass(lean_object*, lean_object*);
lean_object* l_Lean_stringToMessageData(lean_object*);
LEAN_EXPORT lean_object* l_Std_HashMapImp_moveEntries___at_Lean_Meta_AC_toACExpr___spec__9(lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__10;
lean_object* lean_mk_empty_array_with_capacity(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Data_AC_removeNeutrals___at_Lean_Meta_AC_buildNormProof___spec__2(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_AssocList_foldlM___at_Lean_Meta_AC_toACExpr___spec__10(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_getInstance___lambda__2___closed__2;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof_convertTarget___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_getInstance___lambda__2___closed__1;
lean_object* l___private_Std_Data_HashMap_0__Std_numBucketsForCapacity(lean_object*);
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__6;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_name_mk_string(lean_object*, lean_object*);
uint8_t lean_usize_dec_eq(size_t, size_t);
lean_object* lean_array_uget(lean_object*, size_t);
static lean_object* l_Lean_Meta_AC_getInstance___closed__6;
uint64_t lean_uint64_of_nat(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_initFn____x40_Lean_Meta_Tactic_AC_Main___hyg_2111_(lean_object*);
LEAN_EXPORT lean_object* l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr_toPreExpr___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__10;
lean_object* l_Lean_Meta_mkAppM(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___closed__1;
lean_object* lean_array_uset(lean_object*, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Std_HashMapImp_find_x3f___at_Lean_Meta_AC_toACExpr___spec__14(lean_object*, lean_object*);
lean_object* lean_array_fswap(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___boxed(lean_object*);
static lean_object* l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__3;
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__10;
static lean_object* l_Lean_Meta_AC_preContext___closed__10;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__4;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__3;
lean_object* lean_st_ref_get(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_getInstance___closed__1;
LEAN_EXPORT lean_object* l_Std_mkHashMap___at_Lean_Meta_AC_toACExpr___spec__12(lean_object*);
extern lean_object* l_instInhabitedNat;
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__3;
static lean_object* l_Lean_Meta_AC_instInhabitedPreContext___closed__2;
static lean_object* l_Lean_Meta_AC_getInstance___closed__2;
lean_object* lean_array_push(lean_object*, lean_object*);
lean_object* lean_array_get_size(lean_object*);
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__5;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Data_AC_removeNeutrals_loop___at_Lean_Meta_AC_buildNormProof___spec__3(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__7;
LEAN_EXPORT uint8_t l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__2(lean_object*);
lean_object* l_Std_mkHashSetImp___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_ac__refl__tactic(lean_object*);
uint8_t lean_expr_lt(lean_object*, lean_object*);
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__6;
static lean_object* l_Lean_Meta_AC_getInstance___closed__4;
static lean_object* l_Lean_Meta_AC_buildNormProof___closed__5;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_getInstance(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_KeyedDeclsAttribute_addBuiltin___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_usize_dec_lt(size_t, size_t);
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__9;
extern lean_object* l_Lean_levelZero;
lean_object* lean_nat_add(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_preContext___closed__7;
lean_object* l_Lean_Meta_mkEqRefl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__4;
lean_object* l_Lean_mkAppN(lean_object*, lean_object*);
size_t lean_uint64_to_usize(uint64_t);
static lean_object* l_Lean_Meta_AC_buildNormProof___closed__3;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__2;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__2___boxed(lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_convert___closed__5;
static lean_object* l_Lean_Meta_AC_preContext___closed__3;
static lean_object* l_Lean_Meta_AC_getInstance___closed__8;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_ac__refl__tactic___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_insertionSort_traverse___at_Lean_Meta_AC_toACExpr___spec__4(lean_object*, lean_object*, lean_object*);
lean_object* lean_array_fget(lean_object*, lean_object*);
lean_object* l_Std_HashSetImp_insert___at_Lean_CollectMVars_visit___spec__3(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__1;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr_toPreExpr___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
extern lean_object* l_Lean_Meta_Simp_neutralConfig;
lean_object* l_Lean_Meta_getMVarType(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_convert___closed__3;
lean_object* l_Lean_Meta_applyRefl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__11;
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__5;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof_convert(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof_convertTarget(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_Simp_main(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof___closed__7;
lean_object* lean_nat_sub(lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__3;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__1;
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__3;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_getInstance___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__4;
static lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__4;
LEAN_EXPORT lean_object* l_List_foldlM___at_Lean_Meta_AC_toACExpr___spec__2(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_convert___closed__7;
lean_object* l_Lean_addTrace___at_Lean_Meta_processPostponed_loop___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__6;
lean_object* lean_array_get(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_rewriteUnnormalized___closed__3;
lean_object* lean_array_fset(lean_object*, lean_object*, lean_object*);
lean_object* l_Std_mkHashMapImp___rarg(lean_object*);
static lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__2;
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__6;
LEAN_EXPORT lean_object* l_Std_AssocList_contains___at_Lean_Meta_AC_toACExpr___spec__7___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof___closed__1;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__3___boxed(lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof___closed__4;
LEAN_EXPORT lean_object* l_Std_AssocList_replace___at_Lean_Meta_AC_toACExpr___spec__11(lean_object*, lean_object*, lean_object*);
uint64_t l_Lean_Expr_hash(lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof___closed__8;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__7;
lean_object* l_Lean_addBuiltinDeclarationRanges(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Data_AC_Expr_toList(lean_object*);
lean_object* lean_array_to_list(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Data_AC_removeNeutrals___at_Lean_Meta_AC_buildNormProof___spec__2___boxed(lean_object*, lean_object*);
lean_object* l_Lean_Elab_Tactic_getMainGoal(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_AssocList_find_x3f___at_Lean_Meta_AC_toACExpr___spec__15___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_convert___closed__2;
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__2;
static lean_object* l_Lean_Meta_AC_preContext___closed__6;
extern lean_object* l_Lean_instInhabitedExpr;
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__8;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
size_t lean_usize_modn(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__1(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__9;
lean_object* l_Array_unzip___rarg(lean_object*);
lean_object* l___private_Init_Util_0__mkPanicMessageWithDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Data_AC_norm___at_Lean_Meta_AC_buildNormProof___spec__1(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool;
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__16(lean_object*, size_t, size_t, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__4;
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__2;
LEAN_EXPORT lean_object* l_Lean_Data_AC_evalList___at_Lean_Meta_AC_buildNormProof___spec__4(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof___closed__2;
lean_object* l_Lean_Data_AC_mergeIdem(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_bin___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized_post(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__1;
LEAN_EXPORT lean_object* l_Std_HashMapImp_expand___at_Lean_Meta_AC_toACExpr___spec__8(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_rewriteUnnormalized___closed__4;
size_t lean_usize_of_nat(lean_object*);
extern lean_object* l_Lean_Elab_Tactic_tacticElabAttribute;
static lean_object* l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__2;
static lean_object* l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__1;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__3(lean_object*, lean_object*);
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__2;
LEAN_EXPORT lean_object* l_Std_HashMap_insert___at_Lean_Meta_AC_toACExpr___spec__6(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__3(lean_object*, size_t, size_t, lean_object*);
static lean_object* l_Lean_Meta_AC_preContext___closed__9;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_preContext___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__1;
static lean_object* l_Lean_Meta_AC_preContext___closed__4;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_preContext(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_bin(uint64_t, uint64_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_preContext___closed__2;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__5;
static lean_object* l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1___closed__1;
static lean_object* l_Lean_Meta_AC_buildNormProof___closed__6;
lean_object* l___private_Lean_Util_Trace_0__Lean_checkTraceOptionM___at___private_Lean_Meta_Basic_0__Lean_Meta_processPostponedStep___spec__14(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__1;
LEAN_EXPORT lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange(lean_object*);
lean_object* l_Lean_Meta_synthInstance(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_convert___closed__6;
lean_object* l_Lean_Meta_applySimpResultToTarget(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern uint8_t l_instInhabitedBool;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__3;
static lean_object* l_Lean_Meta_AC_toACExpr___closed__1;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof_mkContext(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_expr_eqv(lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__5;
uint8_t lean_nat_dec_le(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_mkApp(lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__3(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized_post___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instInhabitedPreContext;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__12;
static lean_object* l_Lean_Meta_AC_getInstance___closed__5;
static lean_object* l_Lean_Meta_AC_preContext___closed__8;
LEAN_EXPORT lean_object* l_Array_insertionSort_swapLoop___at_Lean_Meta_AC_toACExpr___spec__5(lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__8;
static lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__4;
static lean_object* l_Lean_Meta_AC_preContext___closed__5;
lean_object* l_panic___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Data_AC_evalList___at_Lean_Meta_AC_buildNormProof___spec__4___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_mkApp7(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Data_AC_sort(lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__4;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_getInstance___closed__3;
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__9;
lean_object* l_Lean_mkApp4(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__2(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_getLevel(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_nat_mul(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1(lean_object*);
lean_object* lean_infer_type(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_getInstance___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_isExprDefEq(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__12;
static lean_object* l_Lean_Meta_AC_preContext___closed__1;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__1;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_ac__refl__tactic___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__7;
lean_object* lean_mk_array(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Data_AC_norm___at_Lean_Meta_AC_buildNormProof___spec__1___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__2___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_getInstance___closed__7;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized_post___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Data_AC_removeNeutrals_loop___at_Lean_Meta_AC_buildNormProof___spec__3___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_rewriteUnnormalized___closed__2;
static lean_object* l_Lean_Meta_AC_buildNormProof_mkContext___closed__11;
static lean_object* l_Lean_Meta_AC_instInhabitedPreContext___closed__3;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__1___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__2;
static lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__8;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr_toPreExpr(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_mkNatLit(lean_object*);
static lean_object* l_Lean_Meta_AC_rewriteUnnormalized___closed__1;
static uint64_t l_Lean_Meta_AC_instInhabitedPreContext___closed__1;
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__16___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_AssocList_find_x3f___at_Lean_Meta_AC_toACExpr___spec__15(lean_object*, lean_object*);
lean_object* l_Lean_mkAppB(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_convert___closed__4;
lean_object* l_Lean_indentExpr(lean_object*);
lean_object* l_Lean_Meta_mkListLit(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_mkConst(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_AC_buildNormProof_convert___closed__8;
static lean_object* l_Lean_Meta_AC_buildNormProof_convert___closed__1;
LEAN_EXPORT lean_object* l_Lean_Meta_AC_preContext___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_mkApp3(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__3___boxed(lean_object*, lean_object*);
lean_object* l_Lean_Meta_getSimpCongrTheorems___rarg(lean_object*, lean_object*);
uint8_t lean_nat_dec_lt(lean_object*, lean_object*);
static uint64_t _init_l_Lean_Meta_AC_instInhabitedPreContext___closed__1() {
_start:
{
lean_object* x_1; uint64_t x_2;
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_uint64_of_nat(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Meta_AC_instInhabitedPreContext___closed__2() {
_start:
{
lean_object* x_1; uint64_t x_2; lean_object* x_3;
x_1 = lean_unsigned_to_nat(0u);
x_2 = l_Lean_Meta_AC_instInhabitedPreContext___closed__1;
x_3 = lean_alloc_ctor(0, 1, 8);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set_uint64(x_3, sizeof(void*)*1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_instInhabitedPreContext___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = lean_box(0);
x_2 = lean_unsigned_to_nat(0u);
x_3 = l_Lean_Meta_AC_instInhabitedPreContext___closed__2;
x_4 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_4, 0, x_2);
lean_ctor_set(x_4, 1, x_3);
lean_ctor_set(x_4, 2, x_3);
lean_ctor_set(x_4, 3, x_1);
lean_ctor_set(x_4, 4, x_1);
return x_4;
}
}
static lean_object* _init_l_Lean_Meta_AC_instInhabitedPreContext() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_Meta_AC_instInhabitedPreContext___closed__3;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__1(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint8_t x_4; lean_object* x_5; lean_object* x_6;
x_3 = lean_ctor_get(x_1, 1);
x_4 = l_instInhabitedBool;
x_5 = lean_box(x_4);
x_6 = lean_array_get(x_5, x_3, x_2);
return x_6;
}
}
LEAN_EXPORT uint8_t l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__2(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = lean_ctor_get(x_1, 0);
x_3 = lean_ctor_get(x_2, 3);
if (lean_obj_tag(x_3) == 0)
{
uint8_t x_4;
x_4 = 0;
return x_4;
}
else
{
uint8_t x_5;
x_5 = 1;
return x_5;
}
}
}
LEAN_EXPORT uint8_t l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__3(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = lean_ctor_get(x_1, 0);
x_3 = lean_ctor_get(x_2, 4);
if (lean_obj_tag(x_3) == 0)
{
uint8_t x_4;
x_4 = 0;
return x_4;
}
else
{
uint8_t x_5;
x_5 = 1;
return x_5;
}
}
}
static lean_object* _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__1___boxed), 2, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__2___boxed), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__3___boxed), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__1;
x_2 = l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__2;
x_3 = l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__3;
x_4 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__4;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__1(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__2___boxed(lean_object* x_1) {
_start:
{
uint8_t x_2; lean_object* x_3;
x_2 = l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__2(x_1);
lean_dec(x_1);
x_3 = lean_box(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__3___boxed(lean_object* x_1) {
_start:
{
uint8_t x_2; lean_object* x_3;
x_2 = l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___lambda__3(x_1);
lean_dec(x_1);
x_3 = lean_box(x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___closed__1;
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_4, 0, x_2);
lean_ctor_set(x_4, 1, x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__3(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_3, 0, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___boxed), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__2___boxed), 3, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__3___boxed), 2, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__1;
x_2 = l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__2;
x_3 = l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__3;
x_4 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__4;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__2(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__3___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__3(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_getInstance___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_8, 0, x_1);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_9, 1, x_7);
return x_9;
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___lambda__2___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("got instance", 12);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___lambda__2___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Meta_AC_getInstance___lambda__2___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_getInstance___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10;
lean_dec(x_3);
x_9 = lean_box(0);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_10 = l_Lean_Meta_synthInstance(x_1, x_9, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_10) == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16;
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = lean_st_ref_get(x_7, x_12);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_14, 3);
lean_inc(x_15);
lean_dec(x_14);
x_16 = lean_ctor_get_uint8(x_15, sizeof(void*)*1);
lean_dec(x_15);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
lean_dec(x_2);
x_17 = lean_ctor_get(x_13, 1);
lean_inc(x_17);
lean_dec(x_13);
x_18 = lean_box(0);
x_19 = l_Lean_Meta_AC_getInstance___lambda__1(x_11, x_18, x_4, x_5, x_6, x_7, x_17);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_19;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_23;
x_20 = lean_ctor_get(x_13, 1);
lean_inc(x_20);
lean_dec(x_13);
lean_inc(x_2);
x_21 = l___private_Lean_Util_Trace_0__Lean_checkTraceOptionM___at___private_Lean_Meta_Basic_0__Lean_Meta_processPostponedStep___spec__14(x_2, x_4, x_5, x_6, x_7, x_20);
x_22 = lean_ctor_get(x_21, 0);
lean_inc(x_22);
x_23 = lean_unbox(x_22);
lean_dec(x_22);
if (x_23 == 0)
{
lean_object* x_24; lean_object* x_25; lean_object* x_26;
lean_dec(x_2);
x_24 = lean_ctor_get(x_21, 1);
lean_inc(x_24);
lean_dec(x_21);
x_25 = lean_box(0);
x_26 = l_Lean_Meta_AC_getInstance___lambda__1(x_11, x_25, x_4, x_5, x_6, x_7, x_24);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_26;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_27 = lean_ctor_get(x_21, 1);
lean_inc(x_27);
lean_dec(x_21);
x_28 = l_Lean_Meta_AC_getInstance___lambda__2___closed__2;
x_29 = l_Lean_addTrace___at_Lean_Meta_processPostponed_loop___spec__1(x_2, x_28, x_4, x_5, x_6, x_7, x_27);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = l_Lean_Meta_AC_getInstance___lambda__1(x_11, x_30, x_4, x_5, x_6, x_7, x_31);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_30);
return x_32;
}
}
}
else
{
uint8_t x_33;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
x_33 = !lean_is_exclusive(x_10);
if (x_33 == 0)
{
return x_10;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_34 = lean_ctor_get(x_10, 0);
x_35 = lean_ctor_get(x_10, 1);
lean_inc(x_35);
lean_inc(x_34);
lean_dec(x_10);
x_36 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_35);
return x_36;
}
}
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Meta", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_Meta_AC_getInstance___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("AC", 2);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_getInstance___closed__2;
x_2 = l_Lean_Meta_AC_getInstance___closed__3;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("trying: ", 8);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Meta_AC_getInstance___closed__5;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("", 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_getInstance___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Meta_AC_getInstance___closed__7;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_getInstance(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_3);
x_8 = l_Lean_Meta_mkAppM(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
if (lean_obj_tag(x_8) == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12; lean_object* x_13; lean_object* x_46; lean_object* x_47; lean_object* x_48; uint8_t x_49;
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
x_10 = lean_ctor_get(x_8, 1);
lean_inc(x_10);
lean_dec(x_8);
x_11 = l_Lean_Meta_AC_getInstance___closed__4;
x_46 = lean_st_ref_get(x_6, x_10);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_47, 3);
lean_inc(x_48);
lean_dec(x_47);
x_49 = lean_ctor_get_uint8(x_48, sizeof(void*)*1);
lean_dec(x_48);
if (x_49 == 0)
{
lean_object* x_50; uint8_t x_51;
x_50 = lean_ctor_get(x_46, 1);
lean_inc(x_50);
lean_dec(x_46);
x_51 = 0;
x_12 = x_51;
x_13 = x_50;
goto block_45;
}
else
{
lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; uint8_t x_56;
x_52 = lean_ctor_get(x_46, 1);
lean_inc(x_52);
lean_dec(x_46);
x_53 = l___private_Lean_Util_Trace_0__Lean_checkTraceOptionM___at___private_Lean_Meta_Basic_0__Lean_Meta_processPostponedStep___spec__14(x_11, x_3, x_4, x_5, x_6, x_52);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
lean_dec(x_53);
x_56 = lean_unbox(x_54);
lean_dec(x_54);
x_12 = x_56;
x_13 = x_55;
goto block_45;
}
block_45:
{
if (x_12 == 0)
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_box(0);
x_15 = l_Lean_Meta_AC_getInstance___lambda__2(x_9, x_11, x_14, x_3, x_4, x_5, x_6, x_13);
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_16;
x_16 = !lean_is_exclusive(x_15);
if (x_16 == 0)
{
return x_15;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_17 = lean_ctor_get(x_15, 0);
x_18 = lean_ctor_get(x_15, 1);
lean_inc(x_18);
lean_inc(x_17);
lean_dec(x_15);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_17);
lean_ctor_set(x_19, 1, x_18);
return x_19;
}
}
else
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_15);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_ctor_get(x_15, 0);
lean_dec(x_21);
x_22 = lean_box(0);
lean_ctor_set_tag(x_15, 0);
lean_ctor_set(x_15, 0, x_22);
return x_15;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_15, 1);
lean_inc(x_23);
lean_dec(x_15);
x_24 = lean_box(0);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_23);
return x_25;
}
}
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34;
lean_inc(x_9);
x_26 = l_Lean_indentExpr(x_9);
x_27 = l_Lean_Meta_AC_getInstance___closed__6;
x_28 = lean_alloc_ctor(10, 2, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_28, 1, x_26);
x_29 = l_Lean_Meta_AC_getInstance___closed__8;
x_30 = lean_alloc_ctor(10, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
x_31 = l_Lean_addTrace___at_Lean_Meta_processPostponed_loop___spec__1(x_11, x_30, x_3, x_4, x_5, x_6, x_13);
x_32 = lean_ctor_get(x_31, 0);
lean_inc(x_32);
x_33 = lean_ctor_get(x_31, 1);
lean_inc(x_33);
lean_dec(x_31);
x_34 = l_Lean_Meta_AC_getInstance___lambda__2(x_9, x_11, x_32, x_3, x_4, x_5, x_6, x_33);
if (lean_obj_tag(x_34) == 0)
{
uint8_t x_35;
x_35 = !lean_is_exclusive(x_34);
if (x_35 == 0)
{
return x_34;
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_36 = lean_ctor_get(x_34, 0);
x_37 = lean_ctor_get(x_34, 1);
lean_inc(x_37);
lean_inc(x_36);
lean_dec(x_34);
x_38 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_38, 0, x_36);
lean_ctor_set(x_38, 1, x_37);
return x_38;
}
}
else
{
uint8_t x_39;
x_39 = !lean_is_exclusive(x_34);
if (x_39 == 0)
{
lean_object* x_40; lean_object* x_41;
x_40 = lean_ctor_get(x_34, 0);
lean_dec(x_40);
x_41 = lean_box(0);
lean_ctor_set_tag(x_34, 0);
lean_ctor_set(x_34, 0, x_41);
return x_34;
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_42 = lean_ctor_get(x_34, 1);
lean_inc(x_42);
lean_dec(x_34);
x_43 = lean_box(0);
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_42);
return x_44;
}
}
}
}
}
else
{
uint8_t x_57;
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_57 = !lean_is_exclusive(x_8);
if (x_57 == 0)
{
lean_object* x_58; lean_object* x_59;
x_58 = lean_ctor_get(x_8, 0);
lean_dec(x_58);
x_59 = lean_box(0);
lean_ctor_set_tag(x_8, 0);
lean_ctor_set(x_8, 0, x_59);
return x_8;
}
else
{
lean_object* x_60; lean_object* x_61; lean_object* x_62;
x_60 = lean_ctor_get(x_8, 1);
lean_inc(x_60);
lean_dec(x_8);
x_61 = lean_box(0);
x_62 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_62, 0, x_61);
lean_ctor_set(x_62, 1, x_60);
return x_62;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_getInstance___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_Meta_AC_getInstance___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_preContext___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8;
x_7 = lean_box(0);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_6);
return x_8;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Lean", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_Meta_AC_preContext___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("IsAssociative", 13);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_preContext___closed__2;
x_2 = l_Lean_Meta_AC_preContext___closed__3;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(1u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_AC_preContext___lambda__1___boxed), 6, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("IsCommutative", 13);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_preContext___closed__2;
x_2 = l_Lean_Meta_AC_preContext___closed__7;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__9() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("IsIdempotent", 12);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_preContext___closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_preContext___closed__2;
x_2 = l_Lean_Meta_AC_preContext___closed__9;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_preContext(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_7 = l_Lean_Meta_AC_preContext___closed__5;
lean_inc(x_1);
x_8 = lean_array_push(x_7, x_1);
x_9 = l_Lean_Meta_AC_preContext___closed__4;
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_3);
lean_inc(x_2);
lean_inc(x_8);
x_10 = l_Lean_Meta_AC_getInstance(x_9, x_8, x_2, x_3, x_4, x_5, x_6);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
if (lean_obj_tag(x_11) == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
lean_dec(x_8);
lean_dec(x_1);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_Meta_AC_preContext___closed__6;
x_14 = lean_box(0);
x_15 = lean_apply_6(x_13, x_14, x_2, x_3, x_4, x_5, x_12);
return x_15;
}
else
{
lean_object* x_16; uint8_t x_17;
x_16 = lean_ctor_get(x_10, 1);
lean_inc(x_16);
lean_dec(x_10);
x_17 = !lean_is_exclusive(x_11);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; uint8_t x_25;
x_18 = lean_ctor_get(x_11, 0);
x_19 = l_Lean_Meta_AC_preContext___closed__8;
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_3);
lean_inc(x_2);
lean_inc(x_8);
x_20 = l_Lean_Meta_AC_getInstance(x_19, x_8, x_2, x_3, x_4, x_5, x_16);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = l_Lean_Meta_AC_preContext___closed__10;
x_24 = l_Lean_Meta_AC_getInstance(x_23, x_8, x_2, x_3, x_4, x_5, x_22);
x_25 = !lean_is_exclusive(x_24);
if (x_25 == 0)
{
lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_26 = lean_ctor_get(x_24, 0);
x_27 = lean_unsigned_to_nat(0u);
x_28 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_28, 1, x_1);
lean_ctor_set(x_28, 2, x_18);
lean_ctor_set(x_28, 3, x_21);
lean_ctor_set(x_28, 4, x_26);
lean_ctor_set(x_11, 0, x_28);
lean_ctor_set(x_24, 0, x_11);
return x_24;
}
else
{
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_29 = lean_ctor_get(x_24, 0);
x_30 = lean_ctor_get(x_24, 1);
lean_inc(x_30);
lean_inc(x_29);
lean_dec(x_24);
x_31 = lean_unsigned_to_nat(0u);
x_32 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_1);
lean_ctor_set(x_32, 2, x_18);
lean_ctor_set(x_32, 3, x_21);
lean_ctor_set(x_32, 4, x_29);
lean_ctor_set(x_11, 0, x_32);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_11);
lean_ctor_set(x_33, 1, x_30);
return x_33;
}
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_34 = lean_ctor_get(x_11, 0);
lean_inc(x_34);
lean_dec(x_11);
x_35 = l_Lean_Meta_AC_preContext___closed__8;
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_3);
lean_inc(x_2);
lean_inc(x_8);
x_36 = l_Lean_Meta_AC_getInstance(x_35, x_8, x_2, x_3, x_4, x_5, x_16);
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_36, 1);
lean_inc(x_38);
lean_dec(x_36);
x_39 = l_Lean_Meta_AC_preContext___closed__10;
x_40 = l_Lean_Meta_AC_getInstance(x_39, x_8, x_2, x_3, x_4, x_5, x_38);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
if (lean_is_exclusive(x_40)) {
lean_ctor_release(x_40, 0);
lean_ctor_release(x_40, 1);
x_43 = x_40;
} else {
lean_dec_ref(x_40);
x_43 = lean_box(0);
}
x_44 = lean_unsigned_to_nat(0u);
x_45 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_45, 0, x_44);
lean_ctor_set(x_45, 1, x_1);
lean_ctor_set(x_45, 2, x_34);
lean_ctor_set(x_45, 3, x_37);
lean_ctor_set(x_45, 4, x_41);
x_46 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_46, 0, x_45);
if (lean_is_scalar(x_43)) {
x_47 = lean_alloc_ctor(0, 2, 0);
} else {
x_47 = x_43;
}
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_42);
return x_47;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_preContext___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Lean_Meta_AC_preContext___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_bin(uint64_t x_1, uint64_t x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7;
x_6 = lean_alloc_ctor(5, 2, 8);
lean_ctor_set(x_6, 0, x_3);
lean_ctor_set(x_6, 1, x_4);
lean_ctor_set_uint64(x_6, sizeof(void*)*2, x_1);
x_7 = lean_alloc_ctor(5, 2, 8);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_5);
lean_ctor_set_uint64(x_7, sizeof(void*)*2, x_2);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_bin___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint64_t x_6; uint64_t x_7; lean_object* x_8;
x_6 = lean_unbox_uint64(x_1);
lean_dec(x_1);
x_7 = lean_unbox_uint64(x_2);
lean_dec(x_2);
x_8 = l_Lean_Meta_AC_bin(x_6, x_7, x_3, x_4, x_5);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr_toPreExpr___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
lean_inc(x_1);
x_9 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_9, 0, x_1);
x_10 = l_Std_HashSetImp_insert___at_Lean_CollectMVars_visit___spec__3(x_3, x_1);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_9);
lean_ctor_set(x_11, 1, x_10);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_8);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr_toPreExpr(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
if (lean_obj_tag(x_2) == 5)
{
lean_object* x_9;
x_9 = lean_ctor_get(x_2, 0);
lean_inc(x_9);
if (lean_obj_tag(x_9) == 5)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_2, 1);
lean_inc(x_10);
x_11 = lean_ctor_get(x_9, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_9, 1);
lean_inc(x_12);
lean_dec(x_9);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_1);
x_13 = l_Lean_Meta_isExprDefEq(x_1, x_11, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; uint8_t x_15;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_unbox(x_14);
lean_dec(x_14);
if (x_15 == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
lean_dec(x_12);
lean_dec(x_10);
lean_dec(x_1);
x_16 = lean_ctor_get(x_13, 1);
lean_inc(x_16);
lean_dec(x_13);
x_17 = lean_box(0);
x_18 = l_Lean_Meta_AC_toACExpr_toPreExpr___lambda__1(x_2, x_17, x_3, x_4, x_5, x_6, x_7, x_16);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_18;
}
else
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_2);
x_19 = lean_ctor_get(x_13, 1);
lean_inc(x_19);
lean_dec(x_13);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_1);
x_20 = l_Lean_Meta_AC_toACExpr_toPreExpr(x_1, x_12, x_3, x_4, x_5, x_6, x_7, x_19);
if (lean_obj_tag(x_20) == 0)
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = lean_ctor_get(x_21, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_21, 1);
lean_inc(x_24);
lean_dec(x_21);
x_25 = l_Lean_Meta_AC_toACExpr_toPreExpr(x_1, x_10, x_24, x_4, x_5, x_6, x_7, x_22);
if (lean_obj_tag(x_25) == 0)
{
uint8_t x_26;
x_26 = !lean_is_exclusive(x_25);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28;
x_27 = lean_ctor_get(x_25, 0);
x_28 = !lean_is_exclusive(x_27);
if (x_28 == 0)
{
lean_object* x_29; lean_object* x_30;
x_29 = lean_ctor_get(x_27, 0);
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_23);
lean_ctor_set(x_30, 1, x_29);
lean_ctor_set(x_27, 0, x_30);
return x_25;
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_31 = lean_ctor_get(x_27, 0);
x_32 = lean_ctor_get(x_27, 1);
lean_inc(x_32);
lean_inc(x_31);
lean_dec(x_27);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_23);
lean_ctor_set(x_33, 1, x_31);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_32);
lean_ctor_set(x_25, 0, x_34);
return x_25;
}
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_35 = lean_ctor_get(x_25, 0);
x_36 = lean_ctor_get(x_25, 1);
lean_inc(x_36);
lean_inc(x_35);
lean_dec(x_25);
x_37 = lean_ctor_get(x_35, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_35, 1);
lean_inc(x_38);
if (lean_is_exclusive(x_35)) {
lean_ctor_release(x_35, 0);
lean_ctor_release(x_35, 1);
x_39 = x_35;
} else {
lean_dec_ref(x_35);
x_39 = lean_box(0);
}
x_40 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_40, 0, x_23);
lean_ctor_set(x_40, 1, x_37);
if (lean_is_scalar(x_39)) {
x_41 = lean_alloc_ctor(0, 2, 0);
} else {
x_41 = x_39;
}
lean_ctor_set(x_41, 0, x_40);
lean_ctor_set(x_41, 1, x_38);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_36);
return x_42;
}
}
else
{
uint8_t x_43;
lean_dec(x_23);
x_43 = !lean_is_exclusive(x_25);
if (x_43 == 0)
{
return x_25;
}
else
{
lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_44 = lean_ctor_get(x_25, 0);
x_45 = lean_ctor_get(x_25, 1);
lean_inc(x_45);
lean_inc(x_44);
lean_dec(x_25);
x_46 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_46, 0, x_44);
lean_ctor_set(x_46, 1, x_45);
return x_46;
}
}
}
else
{
uint8_t x_47;
lean_dec(x_10);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_47 = !lean_is_exclusive(x_20);
if (x_47 == 0)
{
return x_20;
}
else
{
lean_object* x_48; lean_object* x_49; lean_object* x_50;
x_48 = lean_ctor_get(x_20, 0);
x_49 = lean_ctor_get(x_20, 1);
lean_inc(x_49);
lean_inc(x_48);
lean_dec(x_20);
x_50 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_50, 0, x_48);
lean_ctor_set(x_50, 1, x_49);
return x_50;
}
}
}
}
else
{
uint8_t x_51;
lean_dec(x_12);
lean_dec(x_10);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_51 = !lean_is_exclusive(x_13);
if (x_51 == 0)
{
return x_13;
}
else
{
lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_52 = lean_ctor_get(x_13, 0);
x_53 = lean_ctor_get(x_13, 1);
lean_inc(x_53);
lean_inc(x_52);
lean_dec(x_13);
x_54 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_54, 0, x_52);
lean_ctor_set(x_54, 1, x_53);
return x_54;
}
}
}
else
{
lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58;
lean_dec(x_9);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
lean_inc(x_2);
x_55 = l_Std_HashSetImp_insert___at_Lean_CollectMVars_visit___spec__3(x_3, x_2);
x_56 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_56, 0, x_2);
x_57 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_57, 1, x_55);
x_58 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_8);
return x_58;
}
}
else
{
lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
lean_inc(x_2);
x_59 = l_Std_HashSetImp_insert___at_Lean_CollectMVars_visit___spec__3(x_3, x_2);
x_60 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_60, 0, x_2);
x_61 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_61, 0, x_60);
lean_ctor_set(x_61, 1, x_59);
x_62 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_62, 0, x_61);
lean_ctor_set(x_62, 1, x_8);
return x_62;
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr_toPreExpr___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9;
x_9 = l_Lean_Meta_AC_toACExpr_toPreExpr___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr_toACExpr(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
x_4 = lean_ctor_get(x_2, 1);
lean_inc(x_4);
lean_dec(x_2);
lean_inc(x_1);
x_5 = l_Lean_Meta_AC_toACExpr_toACExpr(x_1, x_3);
x_6 = l_Lean_Meta_AC_toACExpr_toACExpr(x_1, x_4);
x_7 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_7, 0, x_5);
lean_ctor_set(x_7, 1, x_6);
return x_7;
}
else
{
lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_8 = lean_ctor_get(x_2, 0);
lean_inc(x_8);
lean_dec(x_2);
x_9 = lean_apply_1(x_1, x_8);
x_10 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_10, 0, x_9);
return x_10;
}
}
}
LEAN_EXPORT lean_object* l_List_foldlM___at_Lean_Meta_AC_toACExpr___spec__2(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
return x_1;
}
else
{
lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
x_4 = lean_ctor_get(x_2, 1);
lean_inc(x_4);
lean_dec(x_2);
x_5 = lean_array_push(x_1, x_3);
x_1 = x_5;
x_2 = x_4;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__3(lean_object* x_1, size_t x_2, size_t x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_eq(x_2, x_3);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; size_t x_8; size_t x_9;
x_6 = lean_array_uget(x_1, x_2);
x_7 = l_List_foldlM___at_Lean_Meta_AC_toACExpr___spec__2(x_4, x_6);
x_8 = 1;
x_9 = lean_usize_add(x_2, x_8);
x_2 = x_9;
x_4 = x_7;
goto _start;
}
else
{
return x_4;
}
}
}
static lean_object* _init_l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_2 = lean_ctor_get(x_1, 1);
lean_inc(x_2);
lean_dec(x_1);
x_3 = lean_array_get_size(x_2);
x_4 = lean_unsigned_to_nat(0u);
x_5 = lean_nat_dec_lt(x_4, x_3);
if (x_5 == 0)
{
lean_object* x_6;
lean_dec(x_3);
lean_dec(x_2);
x_6 = l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1___closed__1;
return x_6;
}
else
{
uint8_t x_7;
x_7 = lean_nat_dec_le(x_3, x_3);
if (x_7 == 0)
{
lean_object* x_8;
lean_dec(x_3);
lean_dec(x_2);
x_8 = l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1___closed__1;
return x_8;
}
else
{
size_t x_9; size_t x_10; lean_object* x_11; lean_object* x_12;
x_9 = 0;
x_10 = lean_usize_of_nat(x_3);
lean_dec(x_3);
x_11 = l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1___closed__1;
x_12 = l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__3(x_2, x_9, x_10, x_11);
lean_dec(x_2);
return x_12;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_insertionSort_swapLoop___at_Lean_Meta_AC_toACExpr___spec__5(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = lean_unsigned_to_nat(0u);
x_5 = lean_nat_dec_eq(x_2, x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_6 = lean_unsigned_to_nat(1u);
x_7 = lean_nat_sub(x_2, x_6);
x_8 = lean_array_fget(x_1, x_2);
x_9 = lean_array_fget(x_1, x_7);
x_10 = lean_expr_lt(x_8, x_9);
lean_dec(x_9);
lean_dec(x_8);
if (x_10 == 0)
{
lean_dec(x_7);
lean_dec(x_2);
return x_1;
}
else
{
lean_object* x_11;
x_11 = lean_array_fswap(x_1, x_2, x_7);
lean_dec(x_2);
x_1 = x_11;
x_2 = x_7;
x_3 = lean_box(0);
goto _start;
}
}
else
{
lean_dec(x_2);
return x_1;
}
}
}
LEAN_EXPORT lean_object* l_Array_insertionSort_traverse___at_Lean_Meta_AC_toACExpr___spec__4(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = lean_unsigned_to_nat(0u);
x_5 = lean_nat_dec_eq(x_3, x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_6 = lean_unsigned_to_nat(1u);
x_7 = lean_nat_sub(x_3, x_6);
lean_dec(x_3);
x_8 = lean_array_get_size(x_1);
x_9 = lean_nat_dec_lt(x_2, x_8);
lean_dec(x_8);
if (x_9 == 0)
{
lean_dec(x_7);
lean_dec(x_2);
return x_1;
}
else
{
lean_object* x_10; lean_object* x_11;
lean_inc(x_2);
x_10 = l_Array_insertionSort_swapLoop___at_Lean_Meta_AC_toACExpr___spec__5(x_1, x_2, lean_box(0));
x_11 = lean_nat_add(x_2, x_6);
lean_dec(x_2);
x_1 = x_10;
x_2 = x_11;
x_3 = x_7;
goto _start;
}
}
else
{
lean_dec(x_3);
lean_dec(x_2);
return x_1;
}
}
}
LEAN_EXPORT uint8_t l_Std_AssocList_contains___at_Lean_Meta_AC_toACExpr___spec__7(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
uint8_t x_3;
x_3 = 0;
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; uint8_t x_6;
x_4 = lean_ctor_get(x_2, 0);
x_5 = lean_ctor_get(x_2, 2);
x_6 = lean_expr_eqv(x_4, x_1);
if (x_6 == 0)
{
x_2 = x_5;
goto _start;
}
else
{
uint8_t x_8;
x_8 = 1;
return x_8;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_AssocList_foldlM___at_Lean_Meta_AC_toACExpr___spec__10(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
return x_1;
}
else
{
uint8_t x_3;
x_3 = !lean_is_exclusive(x_2);
if (x_3 == 0)
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; uint64_t x_7; size_t x_8; size_t x_9; lean_object* x_10; lean_object* x_11;
x_4 = lean_ctor_get(x_2, 0);
x_5 = lean_ctor_get(x_2, 2);
x_6 = lean_array_get_size(x_1);
x_7 = l_Lean_Expr_hash(x_4);
x_8 = lean_uint64_to_usize(x_7);
x_9 = lean_usize_modn(x_8, x_6);
lean_dec(x_6);
x_10 = lean_array_uget(x_1, x_9);
lean_ctor_set(x_2, 2, x_10);
x_11 = lean_array_uset(x_1, x_9, x_2);
x_1 = x_11;
x_2 = x_5;
goto _start;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint64_t x_17; size_t x_18; size_t x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_13 = lean_ctor_get(x_2, 0);
x_14 = lean_ctor_get(x_2, 1);
x_15 = lean_ctor_get(x_2, 2);
lean_inc(x_15);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_2);
x_16 = lean_array_get_size(x_1);
x_17 = l_Lean_Expr_hash(x_13);
x_18 = lean_uint64_to_usize(x_17);
x_19 = lean_usize_modn(x_18, x_16);
lean_dec(x_16);
x_20 = lean_array_uget(x_1, x_19);
x_21 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_21, 0, x_13);
lean_ctor_set(x_21, 1, x_14);
lean_ctor_set(x_21, 2, x_20);
x_22 = lean_array_uset(x_1, x_19, x_21);
x_1 = x_22;
x_2 = x_15;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_HashMapImp_moveEntries___at_Lean_Meta_AC_toACExpr___spec__9(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = lean_array_get_size(x_2);
x_5 = lean_nat_dec_lt(x_1, x_4);
lean_dec(x_4);
if (x_5 == 0)
{
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_6 = lean_array_fget(x_2, x_1);
x_7 = lean_box(0);
x_8 = lean_array_fset(x_2, x_1, x_7);
x_9 = l_Std_AssocList_foldlM___at_Lean_Meta_AC_toACExpr___spec__10(x_3, x_6);
x_10 = lean_unsigned_to_nat(1u);
x_11 = lean_nat_add(x_1, x_10);
lean_dec(x_1);
x_1 = x_11;
x_2 = x_8;
x_3 = x_9;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Std_HashMapImp_expand___at_Lean_Meta_AC_toACExpr___spec__8(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_3 = lean_array_get_size(x_2);
x_4 = lean_unsigned_to_nat(2u);
x_5 = lean_nat_mul(x_3, x_4);
lean_dec(x_3);
x_6 = lean_box(0);
x_7 = lean_mk_array(x_5, x_6);
x_8 = lean_unsigned_to_nat(0u);
x_9 = l_Std_HashMapImp_moveEntries___at_Lean_Meta_AC_toACExpr___spec__9(x_8, x_2, x_7);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_1);
lean_ctor_set(x_10, 1, x_9);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Std_AssocList_replace___at_Lean_Meta_AC_toACExpr___spec__11(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_4;
lean_dec(x_2);
lean_dec(x_1);
x_4 = lean_box(0);
return x_4;
}
else
{
uint8_t x_5;
x_5 = !lean_is_exclusive(x_3);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_6 = lean_ctor_get(x_3, 0);
x_7 = lean_ctor_get(x_3, 1);
x_8 = lean_ctor_get(x_3, 2);
x_9 = lean_expr_eqv(x_6, x_1);
if (x_9 == 0)
{
lean_object* x_10;
x_10 = l_Std_AssocList_replace___at_Lean_Meta_AC_toACExpr___spec__11(x_1, x_2, x_8);
lean_ctor_set(x_3, 2, x_10);
return x_3;
}
else
{
lean_dec(x_7);
lean_dec(x_6);
lean_ctor_set(x_3, 1, x_2);
lean_ctor_set(x_3, 0, x_1);
return x_3;
}
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; uint8_t x_14;
x_11 = lean_ctor_get(x_3, 0);
x_12 = lean_ctor_get(x_3, 1);
x_13 = lean_ctor_get(x_3, 2);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_3);
x_14 = lean_expr_eqv(x_11, x_1);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16;
x_15 = l_Std_AssocList_replace___at_Lean_Meta_AC_toACExpr___spec__11(x_1, x_2, x_13);
x_16 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_16, 0, x_11);
lean_ctor_set(x_16, 1, x_12);
lean_ctor_set(x_16, 2, x_15);
return x_16;
}
else
{
lean_object* x_17;
lean_dec(x_12);
lean_dec(x_11);
x_17 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_17, 0, x_1);
lean_ctor_set(x_17, 1, x_2);
lean_ctor_set(x_17, 2, x_13);
return x_17;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Std_HashMap_insert___at_Lean_Meta_AC_toACExpr___spec__6(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4;
x_4 = !lean_is_exclusive(x_1);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint64_t x_8; size_t x_9; size_t x_10; lean_object* x_11; uint8_t x_12;
x_5 = lean_ctor_get(x_1, 0);
x_6 = lean_ctor_get(x_1, 1);
x_7 = lean_array_get_size(x_6);
x_8 = l_Lean_Expr_hash(x_2);
x_9 = lean_uint64_to_usize(x_8);
x_10 = lean_usize_modn(x_9, x_7);
x_11 = lean_array_uget(x_6, x_10);
x_12 = l_Std_AssocList_contains___at_Lean_Meta_AC_toACExpr___spec__7(x_2, x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18;
x_13 = lean_unsigned_to_nat(1u);
x_14 = lean_nat_add(x_5, x_13);
lean_dec(x_5);
x_15 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_15, 0, x_2);
lean_ctor_set(x_15, 1, x_3);
lean_ctor_set(x_15, 2, x_11);
x_16 = lean_array_uset(x_6, x_10, x_15);
x_17 = l___private_Std_Data_HashMap_0__Std_numBucketsForCapacity(x_14);
x_18 = lean_nat_dec_le(x_17, x_7);
lean_dec(x_7);
lean_dec(x_17);
if (x_18 == 0)
{
lean_object* x_19;
lean_free_object(x_1);
x_19 = l_Std_HashMapImp_expand___at_Lean_Meta_AC_toACExpr___spec__8(x_14, x_16);
return x_19;
}
else
{
lean_ctor_set(x_1, 1, x_16);
lean_ctor_set(x_1, 0, x_14);
return x_1;
}
}
else
{
lean_object* x_20; lean_object* x_21;
lean_dec(x_7);
x_20 = l_Std_AssocList_replace___at_Lean_Meta_AC_toACExpr___spec__11(x_2, x_3, x_11);
x_21 = lean_array_uset(x_6, x_10, x_20);
lean_ctor_set(x_1, 1, x_21);
return x_1;
}
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24; uint64_t x_25; size_t x_26; size_t x_27; lean_object* x_28; uint8_t x_29;
x_22 = lean_ctor_get(x_1, 0);
x_23 = lean_ctor_get(x_1, 1);
lean_inc(x_23);
lean_inc(x_22);
lean_dec(x_1);
x_24 = lean_array_get_size(x_23);
x_25 = l_Lean_Expr_hash(x_2);
x_26 = lean_uint64_to_usize(x_25);
x_27 = lean_usize_modn(x_26, x_24);
x_28 = lean_array_uget(x_23, x_27);
x_29 = l_Std_AssocList_contains___at_Lean_Meta_AC_toACExpr___spec__7(x_2, x_28);
if (x_29 == 0)
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; uint8_t x_35;
x_30 = lean_unsigned_to_nat(1u);
x_31 = lean_nat_add(x_22, x_30);
lean_dec(x_22);
x_32 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_32, 0, x_2);
lean_ctor_set(x_32, 1, x_3);
lean_ctor_set(x_32, 2, x_28);
x_33 = lean_array_uset(x_23, x_27, x_32);
x_34 = l___private_Std_Data_HashMap_0__Std_numBucketsForCapacity(x_31);
x_35 = lean_nat_dec_le(x_34, x_24);
lean_dec(x_24);
lean_dec(x_34);
if (x_35 == 0)
{
lean_object* x_36;
x_36 = l_Std_HashMapImp_expand___at_Lean_Meta_AC_toACExpr___spec__8(x_31, x_33);
return x_36;
}
else
{
lean_object* x_37;
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_31);
lean_ctor_set(x_37, 1, x_33);
return x_37;
}
}
else
{
lean_object* x_38; lean_object* x_39; lean_object* x_40;
lean_dec(x_24);
x_38 = l_Std_AssocList_replace___at_Lean_Meta_AC_toACExpr___spec__11(x_2, x_3, x_28);
x_39 = lean_array_uset(x_23, x_27, x_38);
x_40 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_40, 0, x_22);
lean_ctor_set(x_40, 1, x_39);
return x_40;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_mkHashMap___at_Lean_Meta_AC_toACExpr___spec__12(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Std_mkHashMapImp___rarg(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Std_AssocList_find_x3f___at_Lean_Meta_AC_toACExpr___spec__15(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_4 = lean_ctor_get(x_2, 0);
x_5 = lean_ctor_get(x_2, 1);
x_6 = lean_ctor_get(x_2, 2);
x_7 = lean_expr_eqv(x_4, x_1);
if (x_7 == 0)
{
x_2 = x_6;
goto _start;
}
else
{
lean_object* x_9;
lean_inc(x_5);
x_9 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_9, 0, x_5);
return x_9;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_HashMapImp_find_x3f___at_Lean_Meta_AC_toACExpr___spec__14(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint64_t x_5; size_t x_6; size_t x_7; lean_object* x_8; lean_object* x_9;
x_3 = lean_ctor_get(x_1, 1);
lean_inc(x_3);
lean_dec(x_1);
x_4 = lean_array_get_size(x_3);
x_5 = l_Lean_Expr_hash(x_2);
x_6 = lean_uint64_to_usize(x_5);
x_7 = lean_usize_modn(x_6, x_4);
lean_dec(x_4);
x_8 = lean_array_uget(x_3, x_7);
lean_dec(x_3);
x_9 = l_Std_AssocList_find_x3f___at_Lean_Meta_AC_toACExpr___spec__15(x_2, x_8);
lean_dec(x_8);
lean_dec(x_2);
return x_9;
}
}
static lean_object* _init_l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Std.Data.HashMap", 16);
return x_1;
}
}
static lean_object* _init_l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Std.HashMap.find!", 17);
return x_1;
}
}
static lean_object* _init_l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("key is not in the map", 21);
return x_1;
}
}
static lean_object* _init_l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_1 = l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__1;
x_2 = l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__2;
x_3 = lean_unsigned_to_nat(177u);
x_4 = lean_unsigned_to_nat(14u);
x_5 = l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__3;
x_6 = l___private_Init_Util_0__mkPanicMessageWithDecl(x_1, x_2, x_3, x_4, x_5);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Std_HashMapImp_find_x3f___at_Lean_Meta_AC_toACExpr___spec__14(x_2, x_3);
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_5; lean_object* x_6;
x_5 = l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__4;
x_6 = l_panic___rarg(x_1, x_5);
return x_6;
}
else
{
lean_object* x_7;
lean_dec(x_1);
x_7 = lean_ctor_get(x_4, 0);
lean_inc(x_7);
lean_dec(x_4);
return x_7;
}
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__16(lean_object* x_1, size_t x_2, size_t x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_eq(x_2, x_3);
if (x_5 == 0)
{
lean_object* x_6; size_t x_7; size_t x_8; lean_object* x_9; lean_object* x_10;
x_6 = lean_array_uget(x_1, x_2);
x_7 = 1;
x_8 = lean_usize_add(x_2, x_7);
x_9 = lean_ctor_get(x_4, 0);
lean_inc(x_9);
x_10 = l_Std_HashMap_insert___at_Lean_Meta_AC_toACExpr___spec__6(x_4, x_6, x_9);
x_2 = x_8;
x_4 = x_10;
goto _start;
}
else
{
return x_4;
}
}
}
static lean_object* _init_l_Lean_Meta_AC_toACExpr___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(8u);
x_2 = l_Std_mkHashSetImp___rarg(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_toACExpr(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11;
lean_inc(x_1);
x_9 = l_Lean_mkAppB(x_1, x_2, x_3);
x_10 = l_Lean_Meta_AC_toACExpr___closed__1;
x_11 = l_Lean_Meta_AC_toACExpr_toPreExpr(x_1, x_9, x_10, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
x_12 = !lean_is_exclusive(x_11);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_11, 0);
x_14 = !lean_is_exclusive(x_13);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_23;
x_15 = lean_ctor_get(x_13, 0);
x_16 = lean_ctor_get(x_13, 1);
x_17 = l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1(x_16);
x_18 = lean_array_get_size(x_17);
x_19 = lean_unsigned_to_nat(0u);
x_20 = l_Array_insertionSort_traverse___at_Lean_Meta_AC_toACExpr___spec__4(x_17, x_19, x_18);
x_21 = l_Std_mkHashMapImp___rarg(x_19);
x_22 = lean_array_get_size(x_20);
x_23 = lean_nat_dec_lt(x_19, x_22);
if (x_23 == 0)
{
lean_object* x_24; lean_object* x_25; lean_object* x_26;
lean_dec(x_22);
x_24 = l_instInhabitedNat;
x_25 = lean_alloc_closure((void*)(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13), 3, 2);
lean_closure_set(x_25, 0, x_24);
lean_closure_set(x_25, 1, x_21);
x_26 = l_Lean_Meta_AC_toACExpr_toACExpr(x_25, x_15);
lean_ctor_set(x_13, 1, x_26);
lean_ctor_set(x_13, 0, x_20);
return x_11;
}
else
{
uint8_t x_27;
x_27 = lean_nat_dec_le(x_22, x_22);
if (x_27 == 0)
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
lean_dec(x_22);
x_28 = l_instInhabitedNat;
x_29 = lean_alloc_closure((void*)(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13), 3, 2);
lean_closure_set(x_29, 0, x_28);
lean_closure_set(x_29, 1, x_21);
x_30 = l_Lean_Meta_AC_toACExpr_toACExpr(x_29, x_15);
lean_ctor_set(x_13, 1, x_30);
lean_ctor_set(x_13, 0, x_20);
return x_11;
}
else
{
size_t x_31; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_31 = 0;
x_32 = lean_usize_of_nat(x_22);
lean_dec(x_22);
x_33 = l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__16(x_20, x_31, x_32, x_21);
x_34 = l_instInhabitedNat;
x_35 = lean_alloc_closure((void*)(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13), 3, 2);
lean_closure_set(x_35, 0, x_34);
lean_closure_set(x_35, 1, x_33);
x_36 = l_Lean_Meta_AC_toACExpr_toACExpr(x_35, x_15);
lean_ctor_set(x_13, 1, x_36);
lean_ctor_set(x_13, 0, x_20);
return x_11;
}
}
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; uint8_t x_45;
x_37 = lean_ctor_get(x_13, 0);
x_38 = lean_ctor_get(x_13, 1);
lean_inc(x_38);
lean_inc(x_37);
lean_dec(x_13);
x_39 = l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1(x_38);
x_40 = lean_array_get_size(x_39);
x_41 = lean_unsigned_to_nat(0u);
x_42 = l_Array_insertionSort_traverse___at_Lean_Meta_AC_toACExpr___spec__4(x_39, x_41, x_40);
x_43 = l_Std_mkHashMapImp___rarg(x_41);
x_44 = lean_array_get_size(x_42);
x_45 = lean_nat_dec_lt(x_41, x_44);
if (x_45 == 0)
{
lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49;
lean_dec(x_44);
x_46 = l_instInhabitedNat;
x_47 = lean_alloc_closure((void*)(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13), 3, 2);
lean_closure_set(x_47, 0, x_46);
lean_closure_set(x_47, 1, x_43);
x_48 = l_Lean_Meta_AC_toACExpr_toACExpr(x_47, x_37);
x_49 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_49, 0, x_42);
lean_ctor_set(x_49, 1, x_48);
lean_ctor_set(x_11, 0, x_49);
return x_11;
}
else
{
uint8_t x_50;
x_50 = lean_nat_dec_le(x_44, x_44);
if (x_50 == 0)
{
lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54;
lean_dec(x_44);
x_51 = l_instInhabitedNat;
x_52 = lean_alloc_closure((void*)(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13), 3, 2);
lean_closure_set(x_52, 0, x_51);
lean_closure_set(x_52, 1, x_43);
x_53 = l_Lean_Meta_AC_toACExpr_toACExpr(x_52, x_37);
x_54 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_54, 0, x_42);
lean_ctor_set(x_54, 1, x_53);
lean_ctor_set(x_11, 0, x_54);
return x_11;
}
else
{
size_t x_55; size_t x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61;
x_55 = 0;
x_56 = lean_usize_of_nat(x_44);
lean_dec(x_44);
x_57 = l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__16(x_42, x_55, x_56, x_43);
x_58 = l_instInhabitedNat;
x_59 = lean_alloc_closure((void*)(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13), 3, 2);
lean_closure_set(x_59, 0, x_58);
lean_closure_set(x_59, 1, x_57);
x_60 = l_Lean_Meta_AC_toACExpr_toACExpr(x_59, x_37);
x_61 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_61, 0, x_42);
lean_ctor_set(x_61, 1, x_60);
lean_ctor_set(x_11, 0, x_61);
return x_11;
}
}
}
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; uint8_t x_73;
x_62 = lean_ctor_get(x_11, 0);
x_63 = lean_ctor_get(x_11, 1);
lean_inc(x_63);
lean_inc(x_62);
lean_dec(x_11);
x_64 = lean_ctor_get(x_62, 0);
lean_inc(x_64);
x_65 = lean_ctor_get(x_62, 1);
lean_inc(x_65);
if (lean_is_exclusive(x_62)) {
lean_ctor_release(x_62, 0);
lean_ctor_release(x_62, 1);
x_66 = x_62;
} else {
lean_dec_ref(x_62);
x_66 = lean_box(0);
}
x_67 = l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1(x_65);
x_68 = lean_array_get_size(x_67);
x_69 = lean_unsigned_to_nat(0u);
x_70 = l_Array_insertionSort_traverse___at_Lean_Meta_AC_toACExpr___spec__4(x_67, x_69, x_68);
x_71 = l_Std_mkHashMapImp___rarg(x_69);
x_72 = lean_array_get_size(x_70);
x_73 = lean_nat_dec_lt(x_69, x_72);
if (x_73 == 0)
{
lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78;
lean_dec(x_72);
x_74 = l_instInhabitedNat;
x_75 = lean_alloc_closure((void*)(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13), 3, 2);
lean_closure_set(x_75, 0, x_74);
lean_closure_set(x_75, 1, x_71);
x_76 = l_Lean_Meta_AC_toACExpr_toACExpr(x_75, x_64);
if (lean_is_scalar(x_66)) {
x_77 = lean_alloc_ctor(0, 2, 0);
} else {
x_77 = x_66;
}
lean_ctor_set(x_77, 0, x_70);
lean_ctor_set(x_77, 1, x_76);
x_78 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_78, 0, x_77);
lean_ctor_set(x_78, 1, x_63);
return x_78;
}
else
{
uint8_t x_79;
x_79 = lean_nat_dec_le(x_72, x_72);
if (x_79 == 0)
{
lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84;
lean_dec(x_72);
x_80 = l_instInhabitedNat;
x_81 = lean_alloc_closure((void*)(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13), 3, 2);
lean_closure_set(x_81, 0, x_80);
lean_closure_set(x_81, 1, x_71);
x_82 = l_Lean_Meta_AC_toACExpr_toACExpr(x_81, x_64);
if (lean_is_scalar(x_66)) {
x_83 = lean_alloc_ctor(0, 2, 0);
} else {
x_83 = x_66;
}
lean_ctor_set(x_83, 0, x_70);
lean_ctor_set(x_83, 1, x_82);
x_84 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_84, 0, x_83);
lean_ctor_set(x_84, 1, x_63);
return x_84;
}
else
{
size_t x_85; size_t x_86; lean_object* x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92;
x_85 = 0;
x_86 = lean_usize_of_nat(x_72);
lean_dec(x_72);
x_87 = l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__16(x_70, x_85, x_86, x_71);
x_88 = l_instInhabitedNat;
x_89 = lean_alloc_closure((void*)(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13), 3, 2);
lean_closure_set(x_89, 0, x_88);
lean_closure_set(x_89, 1, x_87);
x_90 = l_Lean_Meta_AC_toACExpr_toACExpr(x_89, x_64);
if (lean_is_scalar(x_66)) {
x_91 = lean_alloc_ctor(0, 2, 0);
} else {
x_91 = x_66;
}
lean_ctor_set(x_91, 0, x_70);
lean_ctor_set(x_91, 1, x_90);
x_92 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_92, 0, x_91);
lean_ctor_set(x_92, 1, x_63);
return x_92;
}
}
}
}
else
{
uint8_t x_93;
x_93 = !lean_is_exclusive(x_11);
if (x_93 == 0)
{
return x_11;
}
else
{
lean_object* x_94; lean_object* x_95; lean_object* x_96;
x_94 = lean_ctor_get(x_11, 0);
x_95 = lean_ctor_get(x_11, 1);
lean_inc(x_95);
lean_inc(x_94);
lean_dec(x_11);
x_96 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_96, 0, x_94);
lean_ctor_set(x_96, 1, x_95);
return x_96;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; lean_object* x_7;
x_5 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_6 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_7 = l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__3(x_1, x_5, x_6, x_4);
lean_dec(x_1);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Std_AssocList_contains___at_Lean_Meta_AC_toACExpr___spec__7___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Std_AssocList_contains___at_Lean_Meta_AC_toACExpr___spec__7(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Std_mkHashMap___at_Lean_Meta_AC_toACExpr___spec__12___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Std_mkHashMap___at_Lean_Meta_AC_toACExpr___spec__12(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Std_AssocList_find_x3f___at_Lean_Meta_AC_toACExpr___spec__15___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Std_AssocList_find_x3f___at_Lean_Meta_AC_toACExpr___spec__15(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__16___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; lean_object* x_7;
x_5 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_6 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_7 = l_Array_foldlMUnsafe_fold___at_Lean_Meta_AC_toACExpr___spec__16(x_1, x_5, x_6, x_4);
lean_dec(x_1);
return x_7;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("IsNeutral", 9);
return x_1;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_preContext___closed__2;
x_2 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(2u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Data", 4);
return x_1;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_preContext___closed__2;
x_2 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__4;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__5;
x_2 = l_Lean_Meta_AC_getInstance___closed__3;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Variable", 8);
return x_1;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__6;
x_2 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__7;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__9() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("mk", 2);
return x_1;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__8;
x_2 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__9;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, size_t x_7, size_t x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12, lean_object* x_13, lean_object* x_14) {
_start:
{
uint8_t x_15;
x_15 = lean_usize_dec_lt(x_8, x_7);
if (x_15 == 0)
{
lean_object* x_16;
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_9);
lean_ctor_set(x_16, 1, x_14);
return x_16;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_17 = lean_array_uget(x_9, x_8);
x_18 = lean_unsigned_to_nat(0u);
x_19 = lean_array_uset(x_9, x_8, x_18);
x_20 = lean_ctor_get(x_1, 1);
lean_inc(x_20);
x_21 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__3;
lean_inc(x_20);
x_22 = lean_array_push(x_21, x_20);
lean_inc(x_17);
x_23 = lean_array_push(x_22, x_17);
x_24 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__2;
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_inc(x_10);
x_25 = l_Lean_Meta_AC_getInstance(x_24, x_23, x_10, x_11, x_12, x_13, x_14);
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
x_27 = lean_ctor_get(x_25, 1);
lean_inc(x_27);
lean_dec(x_25);
lean_inc(x_4);
lean_inc(x_3);
x_28 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_28, 0, x_3);
lean_ctor_set(x_28, 1, x_4);
lean_inc(x_28);
x_29 = l_Lean_mkConst(x_24, x_28);
lean_inc(x_17);
lean_inc(x_20);
lean_inc(x_2);
x_30 = l_Lean_mkApp3(x_29, x_2, x_20, x_17);
x_31 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__10;
x_32 = l_Lean_mkConst(x_31, x_28);
if (lean_obj_tag(x_26) == 0)
{
lean_object* x_33; lean_object* x_34; uint8_t x_35; lean_object* x_36; lean_object* x_37; size_t x_38; size_t x_39; lean_object* x_40;
lean_inc(x_5);
x_33 = l_Lean_mkApp(x_5, x_30);
lean_inc(x_2);
x_34 = l_Lean_mkApp4(x_32, x_2, x_20, x_17, x_33);
x_35 = 0;
x_36 = lean_box(x_35);
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_36);
lean_ctor_set(x_37, 1, x_34);
x_38 = 1;
x_39 = lean_usize_add(x_8, x_38);
x_40 = lean_array_uset(x_19, x_8, x_37);
x_8 = x_39;
x_9 = x_40;
x_14 = x_27;
goto _start;
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44; uint8_t x_45; lean_object* x_46; lean_object* x_47; size_t x_48; size_t x_49; lean_object* x_50;
x_42 = lean_ctor_get(x_26, 0);
lean_inc(x_42);
lean_dec(x_26);
lean_inc(x_6);
x_43 = l_Lean_mkAppB(x_6, x_30, x_42);
lean_inc(x_2);
x_44 = l_Lean_mkApp4(x_32, x_2, x_20, x_17, x_43);
x_45 = 1;
x_46 = lean_box(x_45);
x_47 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_44);
x_48 = 1;
x_49 = lean_usize_add(x_8, x_48);
x_50 = lean_array_uset(x_19, x_8, x_47);
x_8 = x_49;
x_9 = x_50;
x_14 = x_27;
goto _start;
}
}
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Option", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("none", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__2;
x_2 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__3;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_levelZero;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_2);
lean_ctor_set(x_3, 1, x_1);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__4;
x_2 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__5;
x_3 = l_Lean_mkConst(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("some", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__2;
x_2 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__7;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__9() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__8;
x_2 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__5;
x_3 = l_Lean_mkConst(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__10() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Context", 7);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__11() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__6;
x_2 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__10;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__12() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__11;
x_2 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__9;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof_mkContext(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; size_t x_15; size_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_23;
x_10 = l_Lean_instInhabitedExpr;
x_11 = lean_unsigned_to_nat(0u);
x_12 = lean_array_get(x_10, x_4, x_11);
x_13 = lean_box(0);
x_14 = lean_array_get_size(x_4);
x_15 = lean_usize_of_nat(x_14);
lean_dec(x_14);
x_16 = 0;
x_17 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__6;
x_18 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__9;
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_3);
lean_inc(x_2);
lean_inc(x_1);
x_19 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1(x_1, x_2, x_3, x_13, x_17, x_18, x_15, x_16, x_4, x_5, x_6, x_7, x_8, x_9);
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
x_22 = l_Array_unzip___rarg(x_20);
lean_dec(x_20);
x_23 = !lean_is_exclusive(x_22);
if (x_23 == 0)
{
lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_24 = lean_ctor_get(x_22, 0);
x_25 = lean_ctor_get(x_22, 1);
x_26 = lean_array_to_list(lean_box(0), x_25);
x_27 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_27, 0, x_3);
lean_ctor_set(x_27, 1, x_13);
x_28 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__8;
lean_inc(x_27);
x_29 = l_Lean_mkConst(x_28, x_27);
x_30 = lean_ctor_get(x_1, 1);
lean_inc(x_30);
lean_inc(x_30);
lean_inc(x_2);
x_31 = l_Lean_mkAppB(x_29, x_2, x_30);
x_32 = l_Lean_Meta_mkListLit(x_31, x_26, x_5, x_6, x_7, x_8, x_21);
if (lean_obj_tag(x_32) == 0)
{
uint8_t x_33;
x_33 = !lean_is_exclusive(x_32);
if (x_33 == 0)
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_34 = lean_ctor_get(x_32, 0);
x_35 = l_Lean_Meta_AC_preContext___closed__8;
lean_inc(x_27);
x_36 = l_Lean_mkConst(x_35, x_27);
lean_inc(x_30);
lean_inc(x_2);
x_37 = l_Lean_mkAppB(x_36, x_2, x_30);
x_38 = lean_ctor_get(x_1, 3);
lean_inc(x_38);
x_39 = l_Lean_Meta_AC_preContext___closed__10;
lean_inc(x_27);
x_40 = l_Lean_mkConst(x_39, x_27);
lean_inc(x_30);
lean_inc(x_2);
x_41 = l_Lean_mkAppB(x_40, x_2, x_30);
x_42 = lean_ctor_get(x_1, 4);
lean_inc(x_42);
x_43 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__12;
x_44 = l_Lean_mkConst(x_43, x_27);
if (lean_obj_tag(x_38) == 0)
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_1, 2);
lean_inc(x_45);
lean_dec(x_1);
x_46 = l_Lean_mkApp(x_17, x_37);
if (lean_obj_tag(x_42) == 0)
{
lean_object* x_47; lean_object* x_48;
x_47 = l_Lean_mkApp(x_17, x_41);
x_48 = l_Lean_mkApp7(x_44, x_2, x_30, x_45, x_46, x_47, x_34, x_12);
lean_ctor_set(x_22, 1, x_48);
lean_ctor_set(x_32, 0, x_22);
return x_32;
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51;
x_49 = lean_ctor_get(x_42, 0);
lean_inc(x_49);
lean_dec(x_42);
x_50 = l_Lean_mkAppB(x_18, x_41, x_49);
x_51 = l_Lean_mkApp7(x_44, x_2, x_30, x_45, x_46, x_50, x_34, x_12);
lean_ctor_set(x_22, 1, x_51);
lean_ctor_set(x_32, 0, x_22);
return x_32;
}
}
else
{
lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_52 = lean_ctor_get(x_1, 2);
lean_inc(x_52);
lean_dec(x_1);
x_53 = lean_ctor_get(x_38, 0);
lean_inc(x_53);
lean_dec(x_38);
x_54 = l_Lean_mkAppB(x_18, x_37, x_53);
if (lean_obj_tag(x_42) == 0)
{
lean_object* x_55; lean_object* x_56;
x_55 = l_Lean_mkApp(x_17, x_41);
x_56 = l_Lean_mkApp7(x_44, x_2, x_30, x_52, x_54, x_55, x_34, x_12);
lean_ctor_set(x_22, 1, x_56);
lean_ctor_set(x_32, 0, x_22);
return x_32;
}
else
{
lean_object* x_57; lean_object* x_58; lean_object* x_59;
x_57 = lean_ctor_get(x_42, 0);
lean_inc(x_57);
lean_dec(x_42);
x_58 = l_Lean_mkAppB(x_18, x_41, x_57);
x_59 = l_Lean_mkApp7(x_44, x_2, x_30, x_52, x_54, x_58, x_34, x_12);
lean_ctor_set(x_22, 1, x_59);
lean_ctor_set(x_32, 0, x_22);
return x_32;
}
}
}
else
{
lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71;
x_60 = lean_ctor_get(x_32, 0);
x_61 = lean_ctor_get(x_32, 1);
lean_inc(x_61);
lean_inc(x_60);
lean_dec(x_32);
x_62 = l_Lean_Meta_AC_preContext___closed__8;
lean_inc(x_27);
x_63 = l_Lean_mkConst(x_62, x_27);
lean_inc(x_30);
lean_inc(x_2);
x_64 = l_Lean_mkAppB(x_63, x_2, x_30);
x_65 = lean_ctor_get(x_1, 3);
lean_inc(x_65);
x_66 = l_Lean_Meta_AC_preContext___closed__10;
lean_inc(x_27);
x_67 = l_Lean_mkConst(x_66, x_27);
lean_inc(x_30);
lean_inc(x_2);
x_68 = l_Lean_mkAppB(x_67, x_2, x_30);
x_69 = lean_ctor_get(x_1, 4);
lean_inc(x_69);
x_70 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__12;
x_71 = l_Lean_mkConst(x_70, x_27);
if (lean_obj_tag(x_65) == 0)
{
lean_object* x_72; lean_object* x_73;
x_72 = lean_ctor_get(x_1, 2);
lean_inc(x_72);
lean_dec(x_1);
x_73 = l_Lean_mkApp(x_17, x_64);
if (lean_obj_tag(x_69) == 0)
{
lean_object* x_74; lean_object* x_75; lean_object* x_76;
x_74 = l_Lean_mkApp(x_17, x_68);
x_75 = l_Lean_mkApp7(x_71, x_2, x_30, x_72, x_73, x_74, x_60, x_12);
lean_ctor_set(x_22, 1, x_75);
x_76 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_76, 0, x_22);
lean_ctor_set(x_76, 1, x_61);
return x_76;
}
else
{
lean_object* x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80;
x_77 = lean_ctor_get(x_69, 0);
lean_inc(x_77);
lean_dec(x_69);
x_78 = l_Lean_mkAppB(x_18, x_68, x_77);
x_79 = l_Lean_mkApp7(x_71, x_2, x_30, x_72, x_73, x_78, x_60, x_12);
lean_ctor_set(x_22, 1, x_79);
x_80 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_80, 0, x_22);
lean_ctor_set(x_80, 1, x_61);
return x_80;
}
}
else
{
lean_object* x_81; lean_object* x_82; lean_object* x_83;
x_81 = lean_ctor_get(x_1, 2);
lean_inc(x_81);
lean_dec(x_1);
x_82 = lean_ctor_get(x_65, 0);
lean_inc(x_82);
lean_dec(x_65);
x_83 = l_Lean_mkAppB(x_18, x_64, x_82);
if (lean_obj_tag(x_69) == 0)
{
lean_object* x_84; lean_object* x_85; lean_object* x_86;
x_84 = l_Lean_mkApp(x_17, x_68);
x_85 = l_Lean_mkApp7(x_71, x_2, x_30, x_81, x_83, x_84, x_60, x_12);
lean_ctor_set(x_22, 1, x_85);
x_86 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_86, 0, x_22);
lean_ctor_set(x_86, 1, x_61);
return x_86;
}
else
{
lean_object* x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90;
x_87 = lean_ctor_get(x_69, 0);
lean_inc(x_87);
lean_dec(x_69);
x_88 = l_Lean_mkAppB(x_18, x_68, x_87);
x_89 = l_Lean_mkApp7(x_71, x_2, x_30, x_81, x_83, x_88, x_60, x_12);
lean_ctor_set(x_22, 1, x_89);
x_90 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_90, 0, x_22);
lean_ctor_set(x_90, 1, x_61);
return x_90;
}
}
}
}
else
{
uint8_t x_91;
lean_dec(x_30);
lean_dec(x_27);
lean_free_object(x_22);
lean_dec(x_24);
lean_dec(x_12);
lean_dec(x_2);
lean_dec(x_1);
x_91 = !lean_is_exclusive(x_32);
if (x_91 == 0)
{
return x_32;
}
else
{
lean_object* x_92; lean_object* x_93; lean_object* x_94;
x_92 = lean_ctor_get(x_32, 0);
x_93 = lean_ctor_get(x_32, 1);
lean_inc(x_93);
lean_inc(x_92);
lean_dec(x_32);
x_94 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_94, 0, x_92);
lean_ctor_set(x_94, 1, x_93);
return x_94;
}
}
}
else
{
lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103;
x_95 = lean_ctor_get(x_22, 0);
x_96 = lean_ctor_get(x_22, 1);
lean_inc(x_96);
lean_inc(x_95);
lean_dec(x_22);
x_97 = lean_array_to_list(lean_box(0), x_96);
x_98 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_98, 0, x_3);
lean_ctor_set(x_98, 1, x_13);
x_99 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__8;
lean_inc(x_98);
x_100 = l_Lean_mkConst(x_99, x_98);
x_101 = lean_ctor_get(x_1, 1);
lean_inc(x_101);
lean_inc(x_101);
lean_inc(x_2);
x_102 = l_Lean_mkAppB(x_100, x_2, x_101);
x_103 = l_Lean_Meta_mkListLit(x_102, x_97, x_5, x_6, x_7, x_8, x_21);
if (lean_obj_tag(x_103) == 0)
{
lean_object* x_104; lean_object* x_105; lean_object* x_106; lean_object* x_107; lean_object* x_108; lean_object* x_109; lean_object* x_110; lean_object* x_111; lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116;
x_104 = lean_ctor_get(x_103, 0);
lean_inc(x_104);
x_105 = lean_ctor_get(x_103, 1);
lean_inc(x_105);
if (lean_is_exclusive(x_103)) {
lean_ctor_release(x_103, 0);
lean_ctor_release(x_103, 1);
x_106 = x_103;
} else {
lean_dec_ref(x_103);
x_106 = lean_box(0);
}
x_107 = l_Lean_Meta_AC_preContext___closed__8;
lean_inc(x_98);
x_108 = l_Lean_mkConst(x_107, x_98);
lean_inc(x_101);
lean_inc(x_2);
x_109 = l_Lean_mkAppB(x_108, x_2, x_101);
x_110 = lean_ctor_get(x_1, 3);
lean_inc(x_110);
x_111 = l_Lean_Meta_AC_preContext___closed__10;
lean_inc(x_98);
x_112 = l_Lean_mkConst(x_111, x_98);
lean_inc(x_101);
lean_inc(x_2);
x_113 = l_Lean_mkAppB(x_112, x_2, x_101);
x_114 = lean_ctor_get(x_1, 4);
lean_inc(x_114);
x_115 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__12;
x_116 = l_Lean_mkConst(x_115, x_98);
if (lean_obj_tag(x_110) == 0)
{
lean_object* x_117; lean_object* x_118;
x_117 = lean_ctor_get(x_1, 2);
lean_inc(x_117);
lean_dec(x_1);
x_118 = l_Lean_mkApp(x_17, x_109);
if (lean_obj_tag(x_114) == 0)
{
lean_object* x_119; lean_object* x_120; lean_object* x_121; lean_object* x_122;
x_119 = l_Lean_mkApp(x_17, x_113);
x_120 = l_Lean_mkApp7(x_116, x_2, x_101, x_117, x_118, x_119, x_104, x_12);
x_121 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_121, 0, x_95);
lean_ctor_set(x_121, 1, x_120);
if (lean_is_scalar(x_106)) {
x_122 = lean_alloc_ctor(0, 2, 0);
} else {
x_122 = x_106;
}
lean_ctor_set(x_122, 0, x_121);
lean_ctor_set(x_122, 1, x_105);
return x_122;
}
else
{
lean_object* x_123; lean_object* x_124; lean_object* x_125; lean_object* x_126; lean_object* x_127;
x_123 = lean_ctor_get(x_114, 0);
lean_inc(x_123);
lean_dec(x_114);
x_124 = l_Lean_mkAppB(x_18, x_113, x_123);
x_125 = l_Lean_mkApp7(x_116, x_2, x_101, x_117, x_118, x_124, x_104, x_12);
x_126 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_126, 0, x_95);
lean_ctor_set(x_126, 1, x_125);
if (lean_is_scalar(x_106)) {
x_127 = lean_alloc_ctor(0, 2, 0);
} else {
x_127 = x_106;
}
lean_ctor_set(x_127, 0, x_126);
lean_ctor_set(x_127, 1, x_105);
return x_127;
}
}
else
{
lean_object* x_128; lean_object* x_129; lean_object* x_130;
x_128 = lean_ctor_get(x_1, 2);
lean_inc(x_128);
lean_dec(x_1);
x_129 = lean_ctor_get(x_110, 0);
lean_inc(x_129);
lean_dec(x_110);
x_130 = l_Lean_mkAppB(x_18, x_109, x_129);
if (lean_obj_tag(x_114) == 0)
{
lean_object* x_131; lean_object* x_132; lean_object* x_133; lean_object* x_134;
x_131 = l_Lean_mkApp(x_17, x_113);
x_132 = l_Lean_mkApp7(x_116, x_2, x_101, x_128, x_130, x_131, x_104, x_12);
x_133 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_133, 0, x_95);
lean_ctor_set(x_133, 1, x_132);
if (lean_is_scalar(x_106)) {
x_134 = lean_alloc_ctor(0, 2, 0);
} else {
x_134 = x_106;
}
lean_ctor_set(x_134, 0, x_133);
lean_ctor_set(x_134, 1, x_105);
return x_134;
}
else
{
lean_object* x_135; lean_object* x_136; lean_object* x_137; lean_object* x_138; lean_object* x_139;
x_135 = lean_ctor_get(x_114, 0);
lean_inc(x_135);
lean_dec(x_114);
x_136 = l_Lean_mkAppB(x_18, x_113, x_135);
x_137 = l_Lean_mkApp7(x_116, x_2, x_101, x_128, x_130, x_136, x_104, x_12);
x_138 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_138, 0, x_95);
lean_ctor_set(x_138, 1, x_137);
if (lean_is_scalar(x_106)) {
x_139 = lean_alloc_ctor(0, 2, 0);
} else {
x_139 = x_106;
}
lean_ctor_set(x_139, 0, x_138);
lean_ctor_set(x_139, 1, x_105);
return x_139;
}
}
}
else
{
lean_object* x_140; lean_object* x_141; lean_object* x_142; lean_object* x_143;
lean_dec(x_101);
lean_dec(x_98);
lean_dec(x_95);
lean_dec(x_12);
lean_dec(x_2);
lean_dec(x_1);
x_140 = lean_ctor_get(x_103, 0);
lean_inc(x_140);
x_141 = lean_ctor_get(x_103, 1);
lean_inc(x_141);
if (lean_is_exclusive(x_103)) {
lean_ctor_release(x_103, 0);
lean_ctor_release(x_103, 1);
x_142 = x_103;
} else {
lean_dec_ref(x_103);
x_142 = lean_box(0);
}
if (lean_is_scalar(x_142)) {
x_143 = lean_alloc_ctor(1, 2, 0);
} else {
x_143 = x_142;
}
lean_ctor_set(x_143, 0, x_140);
lean_ctor_set(x_143, 1, x_141);
return x_143;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12, lean_object* x_13, lean_object* x_14) {
_start:
{
size_t x_15; size_t x_16; lean_object* x_17;
x_15 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_16 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_17 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1(x_1, x_2, x_3, x_4, x_5, x_6, x_15, x_16, x_9, x_10, x_11, x_12, x_13, x_14);
return x_17;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_convert___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Expr", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_convert___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__6;
x_2 = l_Lean_Meta_AC_buildNormProof_convert___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_convert___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("var", 3);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_convert___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_buildNormProof_convert___closed__2;
x_2 = l_Lean_Meta_AC_buildNormProof_convert___closed__3;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_convert___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_Meta_AC_buildNormProof_convert___closed__4;
x_3 = l_Lean_mkConst(x_2, x_1);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_convert___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("op", 2);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_convert___closed__7() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_buildNormProof_convert___closed__2;
x_2 = l_Lean_Meta_AC_buildNormProof_convert___closed__6;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof_convert___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_Meta_AC_buildNormProof_convert___closed__7;
x_3 = l_Lean_mkConst(x_2, x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof_convert(lean_object* x_1) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_2 = lean_ctor_get(x_1, 0);
lean_inc(x_2);
lean_dec(x_1);
x_3 = l_Lean_mkNatLit(x_2);
x_4 = l_Lean_Meta_AC_buildNormProof_convert___closed__5;
x_5 = l_Lean_mkApp(x_4, x_3);
return x_5;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_6 = lean_ctor_get(x_1, 0);
lean_inc(x_6);
x_7 = lean_ctor_get(x_1, 1);
lean_inc(x_7);
lean_dec(x_1);
x_8 = l_Lean_Meta_AC_buildNormProof_convert(x_6);
x_9 = l_Lean_Meta_AC_buildNormProof_convert(x_7);
x_10 = l_Lean_Meta_AC_buildNormProof_convert___closed__8;
x_11 = l_Lean_mkAppB(x_10, x_8, x_9);
return x_11;
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof_convertTarget(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_4; lean_object* x_5; lean_object* x_6;
lean_dec(x_1);
x_4 = lean_ctor_get(x_3, 0);
x_5 = l_Lean_instInhabitedExpr;
x_6 = lean_array_get(x_5, x_2, x_4);
return x_6;
}
else
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_7 = lean_ctor_get(x_3, 0);
x_8 = lean_ctor_get(x_3, 1);
x_9 = lean_ctor_get(x_1, 1);
lean_inc(x_9);
lean_inc(x_1);
x_10 = l_Lean_Meta_AC_buildNormProof_convertTarget(x_1, x_2, x_7);
x_11 = l_Lean_Meta_AC_buildNormProof_convertTarget(x_1, x_2, x_8);
x_12 = l_Lean_mkAppB(x_9, x_10, x_11);
return x_12;
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof_convertTarget___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_Meta_AC_buildNormProof_convertTarget(x_1, x_2, x_3);
lean_dec(x_3);
lean_dec(x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_Data_AC_removeNeutrals_loop___at_Lean_Meta_AC_buildNormProof___spec__3(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
uint8_t x_4;
x_4 = !lean_is_exclusive(x_2);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8; lean_object* x_9; lean_object* x_10; uint8_t x_11;
x_5 = lean_ctor_get(x_2, 0);
x_6 = lean_ctor_get(x_2, 1);
x_7 = lean_ctor_get(x_1, 1);
x_8 = l_instInhabitedBool;
x_9 = lean_box(x_8);
x_10 = lean_array_get(x_9, x_7, x_5);
x_11 = lean_unbox(x_10);
lean_dec(x_10);
if (x_11 == 0)
{
lean_object* x_12;
x_12 = l_Lean_Data_AC_removeNeutrals_loop___at_Lean_Meta_AC_buildNormProof___spec__3(x_1, x_6);
lean_ctor_set(x_2, 1, x_12);
return x_2;
}
else
{
lean_free_object(x_2);
lean_dec(x_5);
x_2 = x_6;
goto _start;
}
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17; lean_object* x_18; lean_object* x_19; uint8_t x_20;
x_14 = lean_ctor_get(x_2, 0);
x_15 = lean_ctor_get(x_2, 1);
lean_inc(x_15);
lean_inc(x_14);
lean_dec(x_2);
x_16 = lean_ctor_get(x_1, 1);
x_17 = l_instInhabitedBool;
x_18 = lean_box(x_17);
x_19 = lean_array_get(x_18, x_16, x_14);
x_20 = lean_unbox(x_19);
lean_dec(x_19);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22;
x_21 = l_Lean_Data_AC_removeNeutrals_loop___at_Lean_Meta_AC_buildNormProof___spec__3(x_1, x_15);
x_22 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_22, 0, x_14);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
else
{
lean_dec(x_14);
x_2 = x_15;
goto _start;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Data_AC_removeNeutrals___at_Lean_Meta_AC_buildNormProof___spec__2(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
uint8_t x_4;
x_4 = !lean_is_exclusive(x_2);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6;
x_5 = lean_ctor_get(x_2, 0);
lean_inc(x_5);
x_6 = l_Lean_Data_AC_removeNeutrals_loop___at_Lean_Meta_AC_buildNormProof___spec__3(x_1, x_2);
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_7; lean_object* x_8;
x_7 = lean_box(0);
x_8 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_8, 0, x_5);
lean_ctor_set(x_8, 1, x_7);
return x_8;
}
else
{
lean_dec(x_5);
return x_6;
}
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_9 = lean_ctor_get(x_2, 0);
x_10 = lean_ctor_get(x_2, 1);
lean_inc(x_10);
lean_inc(x_9);
lean_dec(x_2);
lean_inc(x_9);
x_11 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_11, 0, x_9);
lean_ctor_set(x_11, 1, x_10);
x_12 = l_Lean_Data_AC_removeNeutrals_loop___at_Lean_Meta_AC_buildNormProof___spec__3(x_1, x_11);
if (lean_obj_tag(x_12) == 0)
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_box(0);
x_14 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_14, 0, x_9);
lean_ctor_set(x_14, 1, x_13);
return x_14;
}
else
{
lean_dec(x_9);
return x_12;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Data_AC_norm___at_Lean_Meta_AC_buildNormProof___spec__1(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_3 = l_Lean_Data_AC_Expr_toList(x_2);
x_4 = l_Lean_Data_AC_removeNeutrals___at_Lean_Meta_AC_buildNormProof___spec__2(x_1, x_3);
x_5 = lean_ctor_get(x_1, 0);
x_6 = lean_ctor_get(x_5, 3);
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_7;
x_7 = lean_ctor_get(x_5, 4);
if (lean_obj_tag(x_7) == 0)
{
return x_4;
}
else
{
lean_object* x_8;
x_8 = l_Lean_Data_AC_mergeIdem(x_4);
return x_8;
}
}
else
{
lean_object* x_9;
x_9 = lean_ctor_get(x_5, 4);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10;
x_10 = l_Lean_Data_AC_sort(x_4);
return x_10;
}
else
{
lean_object* x_11; lean_object* x_12;
x_11 = l_Lean_Data_AC_sort(x_4);
x_12 = l_Lean_Data_AC_mergeIdem(x_11);
return x_12;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Data_AC_evalList___at_Lean_Meta_AC_buildNormProof___spec__4(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3;
x_3 = l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___closed__1;
return x_3;
}
else
{
lean_object* x_4;
x_4 = lean_ctor_get(x_2, 1);
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_5; lean_object* x_6;
x_5 = lean_ctor_get(x_2, 0);
lean_inc(x_5);
x_6 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_6, 0, x_5);
return x_6;
}
else
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_7 = lean_ctor_get(x_2, 0);
lean_inc(x_7);
x_8 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_8, 0, x_7);
x_9 = l_Lean_Data_AC_evalList___at_Lean_Meta_AC_buildNormProof___spec__4(x_1, x_4);
x_10 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_10, 0, x_8);
lean_ctor_set(x_10, 1, x_9);
return x_10;
}
}
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Bool", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_Meta_AC_buildNormProof___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("true", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_buildNormProof___closed__2;
x_2 = l_Lean_Meta_AC_buildNormProof___closed__3;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_Meta_AC_buildNormProof___closed__4;
x_3 = l_Lean_mkConst(x_2, x_1);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("eq_of_norm", 10);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof___closed__7() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_buildNormProof_mkContext___closed__11;
x_2 = l_Lean_Meta_AC_buildNormProof___closed__6;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_Meta_AC_buildNormProof___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(5u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_buildNormProof(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10;
x_9 = lean_ctor_get(x_1, 1);
lean_inc(x_9);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_10 = l_Lean_Meta_AC_toACExpr(x_9, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_10) == 0)
{
lean_object* x_11; lean_object* x_12; uint8_t x_13;
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = !lean_is_exclusive(x_11);
if (x_13 == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_14 = lean_ctor_get(x_11, 0);
x_15 = lean_ctor_get(x_11, 1);
x_16 = l_Lean_instInhabitedExpr;
x_17 = lean_unsigned_to_nat(0u);
x_18 = lean_array_get(x_16, x_14, x_17);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_19 = lean_infer_type(x_18, x_4, x_5, x_6, x_7, x_12);
if (lean_obj_tag(x_19) == 0)
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_20);
x_22 = l_Lean_Meta_getLevel(x_20, x_4, x_5, x_6, x_7, x_21);
if (lean_obj_tag(x_22) == 0)
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_14);
lean_inc(x_23);
lean_inc(x_20);
lean_inc(x_1);
x_25 = l_Lean_Meta_AC_buildNormProof_mkContext(x_1, x_20, x_23, x_14, x_4, x_5, x_6, x_7, x_24);
if (lean_obj_tag(x_25) == 0)
{
lean_object* x_26; lean_object* x_27; uint8_t x_28;
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
x_27 = lean_ctor_get(x_25, 1);
lean_inc(x_27);
lean_dec(x_25);
x_28 = !lean_is_exclusive(x_26);
if (x_28 == 0)
{
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_29 = lean_ctor_get(x_26, 0);
x_30 = lean_ctor_get(x_26, 1);
lean_inc(x_1);
lean_ctor_set(x_26, 1, x_29);
lean_ctor_set(x_26, 0, x_1);
x_31 = l_Lean_Data_AC_norm___at_Lean_Meta_AC_buildNormProof___spec__1(x_26, x_15);
lean_dec(x_26);
x_32 = l_Lean_Data_AC_evalList___at_Lean_Meta_AC_buildNormProof___spec__4(x_1, x_31);
lean_dec(x_31);
x_33 = l_Lean_Meta_AC_buildNormProof_convertTarget(x_1, x_14, x_32);
lean_dec(x_14);
x_34 = l_Lean_Meta_AC_buildNormProof_convert(x_15);
x_35 = l_Lean_Meta_AC_buildNormProof_convert(x_32);
x_36 = lean_box(0);
x_37 = l_Lean_Meta_AC_buildNormProof___closed__5;
x_38 = l_Lean_Meta_mkEqRefl(x_37, x_4, x_5, x_6, x_7, x_27);
if (lean_obj_tag(x_38) == 0)
{
uint8_t x_39;
x_39 = !lean_is_exclusive(x_38);
if (x_39 == 0)
{
lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50;
x_40 = lean_ctor_get(x_38, 0);
x_41 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_41, 0, x_23);
lean_ctor_set(x_41, 1, x_36);
x_42 = l_Lean_Meta_AC_buildNormProof___closed__7;
x_43 = l_Lean_mkConst(x_42, x_41);
x_44 = l_Lean_Meta_AC_buildNormProof___closed__8;
x_45 = lean_array_push(x_44, x_20);
x_46 = lean_array_push(x_45, x_30);
x_47 = lean_array_push(x_46, x_34);
x_48 = lean_array_push(x_47, x_35);
x_49 = lean_array_push(x_48, x_40);
x_50 = l_Lean_mkAppN(x_43, x_49);
lean_ctor_set(x_11, 1, x_33);
lean_ctor_set(x_11, 0, x_50);
lean_ctor_set(x_38, 0, x_11);
return x_38;
}
else
{
lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63;
x_51 = lean_ctor_get(x_38, 0);
x_52 = lean_ctor_get(x_38, 1);
lean_inc(x_52);
lean_inc(x_51);
lean_dec(x_38);
x_53 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_53, 0, x_23);
lean_ctor_set(x_53, 1, x_36);
x_54 = l_Lean_Meta_AC_buildNormProof___closed__7;
x_55 = l_Lean_mkConst(x_54, x_53);
x_56 = l_Lean_Meta_AC_buildNormProof___closed__8;
x_57 = lean_array_push(x_56, x_20);
x_58 = lean_array_push(x_57, x_30);
x_59 = lean_array_push(x_58, x_34);
x_60 = lean_array_push(x_59, x_35);
x_61 = lean_array_push(x_60, x_51);
x_62 = l_Lean_mkAppN(x_55, x_61);
lean_ctor_set(x_11, 1, x_33);
lean_ctor_set(x_11, 0, x_62);
x_63 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_63, 0, x_11);
lean_ctor_set(x_63, 1, x_52);
return x_63;
}
}
else
{
uint8_t x_64;
lean_dec(x_35);
lean_dec(x_34);
lean_dec(x_33);
lean_dec(x_30);
lean_dec(x_23);
lean_dec(x_20);
lean_free_object(x_11);
x_64 = !lean_is_exclusive(x_38);
if (x_64 == 0)
{
return x_38;
}
else
{
lean_object* x_65; lean_object* x_66; lean_object* x_67;
x_65 = lean_ctor_get(x_38, 0);
x_66 = lean_ctor_get(x_38, 1);
lean_inc(x_66);
lean_inc(x_65);
lean_dec(x_38);
x_67 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_67, 0, x_65);
lean_ctor_set(x_67, 1, x_66);
return x_67;
}
}
}
else
{
lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78;
x_68 = lean_ctor_get(x_26, 0);
x_69 = lean_ctor_get(x_26, 1);
lean_inc(x_69);
lean_inc(x_68);
lean_dec(x_26);
lean_inc(x_1);
x_70 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_70, 0, x_1);
lean_ctor_set(x_70, 1, x_68);
x_71 = l_Lean_Data_AC_norm___at_Lean_Meta_AC_buildNormProof___spec__1(x_70, x_15);
lean_dec(x_70);
x_72 = l_Lean_Data_AC_evalList___at_Lean_Meta_AC_buildNormProof___spec__4(x_1, x_71);
lean_dec(x_71);
x_73 = l_Lean_Meta_AC_buildNormProof_convertTarget(x_1, x_14, x_72);
lean_dec(x_14);
x_74 = l_Lean_Meta_AC_buildNormProof_convert(x_15);
x_75 = l_Lean_Meta_AC_buildNormProof_convert(x_72);
x_76 = lean_box(0);
x_77 = l_Lean_Meta_AC_buildNormProof___closed__5;
x_78 = l_Lean_Meta_mkEqRefl(x_77, x_4, x_5, x_6, x_7, x_27);
if (lean_obj_tag(x_78) == 0)
{
lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92;
x_79 = lean_ctor_get(x_78, 0);
lean_inc(x_79);
x_80 = lean_ctor_get(x_78, 1);
lean_inc(x_80);
if (lean_is_exclusive(x_78)) {
lean_ctor_release(x_78, 0);
lean_ctor_release(x_78, 1);
x_81 = x_78;
} else {
lean_dec_ref(x_78);
x_81 = lean_box(0);
}
x_82 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_82, 0, x_23);
lean_ctor_set(x_82, 1, x_76);
x_83 = l_Lean_Meta_AC_buildNormProof___closed__7;
x_84 = l_Lean_mkConst(x_83, x_82);
x_85 = l_Lean_Meta_AC_buildNormProof___closed__8;
x_86 = lean_array_push(x_85, x_20);
x_87 = lean_array_push(x_86, x_69);
x_88 = lean_array_push(x_87, x_74);
x_89 = lean_array_push(x_88, x_75);
x_90 = lean_array_push(x_89, x_79);
x_91 = l_Lean_mkAppN(x_84, x_90);
lean_ctor_set(x_11, 1, x_73);
lean_ctor_set(x_11, 0, x_91);
if (lean_is_scalar(x_81)) {
x_92 = lean_alloc_ctor(0, 2, 0);
} else {
x_92 = x_81;
}
lean_ctor_set(x_92, 0, x_11);
lean_ctor_set(x_92, 1, x_80);
return x_92;
}
else
{
lean_object* x_93; lean_object* x_94; lean_object* x_95; lean_object* x_96;
lean_dec(x_75);
lean_dec(x_74);
lean_dec(x_73);
lean_dec(x_69);
lean_dec(x_23);
lean_dec(x_20);
lean_free_object(x_11);
x_93 = lean_ctor_get(x_78, 0);
lean_inc(x_93);
x_94 = lean_ctor_get(x_78, 1);
lean_inc(x_94);
if (lean_is_exclusive(x_78)) {
lean_ctor_release(x_78, 0);
lean_ctor_release(x_78, 1);
x_95 = x_78;
} else {
lean_dec_ref(x_78);
x_95 = lean_box(0);
}
if (lean_is_scalar(x_95)) {
x_96 = lean_alloc_ctor(1, 2, 0);
} else {
x_96 = x_95;
}
lean_ctor_set(x_96, 0, x_93);
lean_ctor_set(x_96, 1, x_94);
return x_96;
}
}
}
else
{
uint8_t x_97;
lean_dec(x_23);
lean_dec(x_20);
lean_free_object(x_11);
lean_dec(x_15);
lean_dec(x_14);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_97 = !lean_is_exclusive(x_25);
if (x_97 == 0)
{
return x_25;
}
else
{
lean_object* x_98; lean_object* x_99; lean_object* x_100;
x_98 = lean_ctor_get(x_25, 0);
x_99 = lean_ctor_get(x_25, 1);
lean_inc(x_99);
lean_inc(x_98);
lean_dec(x_25);
x_100 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_100, 0, x_98);
lean_ctor_set(x_100, 1, x_99);
return x_100;
}
}
}
else
{
uint8_t x_101;
lean_dec(x_20);
lean_free_object(x_11);
lean_dec(x_15);
lean_dec(x_14);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_101 = !lean_is_exclusive(x_22);
if (x_101 == 0)
{
return x_22;
}
else
{
lean_object* x_102; lean_object* x_103; lean_object* x_104;
x_102 = lean_ctor_get(x_22, 0);
x_103 = lean_ctor_get(x_22, 1);
lean_inc(x_103);
lean_inc(x_102);
lean_dec(x_22);
x_104 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_104, 0, x_102);
lean_ctor_set(x_104, 1, x_103);
return x_104;
}
}
}
else
{
uint8_t x_105;
lean_free_object(x_11);
lean_dec(x_15);
lean_dec(x_14);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_105 = !lean_is_exclusive(x_19);
if (x_105 == 0)
{
return x_19;
}
else
{
lean_object* x_106; lean_object* x_107; lean_object* x_108;
x_106 = lean_ctor_get(x_19, 0);
x_107 = lean_ctor_get(x_19, 1);
lean_inc(x_107);
lean_inc(x_106);
lean_dec(x_19);
x_108 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_108, 0, x_106);
lean_ctor_set(x_108, 1, x_107);
return x_108;
}
}
}
else
{
lean_object* x_109; lean_object* x_110; lean_object* x_111; lean_object* x_112; lean_object* x_113; lean_object* x_114;
x_109 = lean_ctor_get(x_11, 0);
x_110 = lean_ctor_get(x_11, 1);
lean_inc(x_110);
lean_inc(x_109);
lean_dec(x_11);
x_111 = l_Lean_instInhabitedExpr;
x_112 = lean_unsigned_to_nat(0u);
x_113 = lean_array_get(x_111, x_109, x_112);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_114 = lean_infer_type(x_113, x_4, x_5, x_6, x_7, x_12);
if (lean_obj_tag(x_114) == 0)
{
lean_object* x_115; lean_object* x_116; lean_object* x_117;
x_115 = lean_ctor_get(x_114, 0);
lean_inc(x_115);
x_116 = lean_ctor_get(x_114, 1);
lean_inc(x_116);
lean_dec(x_114);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_115);
x_117 = l_Lean_Meta_getLevel(x_115, x_4, x_5, x_6, x_7, x_116);
if (lean_obj_tag(x_117) == 0)
{
lean_object* x_118; lean_object* x_119; lean_object* x_120;
x_118 = lean_ctor_get(x_117, 0);
lean_inc(x_118);
x_119 = lean_ctor_get(x_117, 1);
lean_inc(x_119);
lean_dec(x_117);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_109);
lean_inc(x_118);
lean_inc(x_115);
lean_inc(x_1);
x_120 = l_Lean_Meta_AC_buildNormProof_mkContext(x_1, x_115, x_118, x_109, x_4, x_5, x_6, x_7, x_119);
if (lean_obj_tag(x_120) == 0)
{
lean_object* x_121; lean_object* x_122; lean_object* x_123; lean_object* x_124; lean_object* x_125; lean_object* x_126; lean_object* x_127; lean_object* x_128; lean_object* x_129; lean_object* x_130; lean_object* x_131; lean_object* x_132; lean_object* x_133; lean_object* x_134;
x_121 = lean_ctor_get(x_120, 0);
lean_inc(x_121);
x_122 = lean_ctor_get(x_120, 1);
lean_inc(x_122);
lean_dec(x_120);
x_123 = lean_ctor_get(x_121, 0);
lean_inc(x_123);
x_124 = lean_ctor_get(x_121, 1);
lean_inc(x_124);
if (lean_is_exclusive(x_121)) {
lean_ctor_release(x_121, 0);
lean_ctor_release(x_121, 1);
x_125 = x_121;
} else {
lean_dec_ref(x_121);
x_125 = lean_box(0);
}
lean_inc(x_1);
if (lean_is_scalar(x_125)) {
x_126 = lean_alloc_ctor(0, 2, 0);
} else {
x_126 = x_125;
}
lean_ctor_set(x_126, 0, x_1);
lean_ctor_set(x_126, 1, x_123);
x_127 = l_Lean_Data_AC_norm___at_Lean_Meta_AC_buildNormProof___spec__1(x_126, x_110);
lean_dec(x_126);
x_128 = l_Lean_Data_AC_evalList___at_Lean_Meta_AC_buildNormProof___spec__4(x_1, x_127);
lean_dec(x_127);
x_129 = l_Lean_Meta_AC_buildNormProof_convertTarget(x_1, x_109, x_128);
lean_dec(x_109);
x_130 = l_Lean_Meta_AC_buildNormProof_convert(x_110);
x_131 = l_Lean_Meta_AC_buildNormProof_convert(x_128);
x_132 = lean_box(0);
x_133 = l_Lean_Meta_AC_buildNormProof___closed__5;
x_134 = l_Lean_Meta_mkEqRefl(x_133, x_4, x_5, x_6, x_7, x_122);
if (lean_obj_tag(x_134) == 0)
{
lean_object* x_135; lean_object* x_136; lean_object* x_137; lean_object* x_138; lean_object* x_139; lean_object* x_140; lean_object* x_141; lean_object* x_142; lean_object* x_143; lean_object* x_144; lean_object* x_145; lean_object* x_146; lean_object* x_147; lean_object* x_148; lean_object* x_149;
x_135 = lean_ctor_get(x_134, 0);
lean_inc(x_135);
x_136 = lean_ctor_get(x_134, 1);
lean_inc(x_136);
if (lean_is_exclusive(x_134)) {
lean_ctor_release(x_134, 0);
lean_ctor_release(x_134, 1);
x_137 = x_134;
} else {
lean_dec_ref(x_134);
x_137 = lean_box(0);
}
x_138 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_138, 0, x_118);
lean_ctor_set(x_138, 1, x_132);
x_139 = l_Lean_Meta_AC_buildNormProof___closed__7;
x_140 = l_Lean_mkConst(x_139, x_138);
x_141 = l_Lean_Meta_AC_buildNormProof___closed__8;
x_142 = lean_array_push(x_141, x_115);
x_143 = lean_array_push(x_142, x_124);
x_144 = lean_array_push(x_143, x_130);
x_145 = lean_array_push(x_144, x_131);
x_146 = lean_array_push(x_145, x_135);
x_147 = l_Lean_mkAppN(x_140, x_146);
x_148 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_148, 0, x_147);
lean_ctor_set(x_148, 1, x_129);
if (lean_is_scalar(x_137)) {
x_149 = lean_alloc_ctor(0, 2, 0);
} else {
x_149 = x_137;
}
lean_ctor_set(x_149, 0, x_148);
lean_ctor_set(x_149, 1, x_136);
return x_149;
}
else
{
lean_object* x_150; lean_object* x_151; lean_object* x_152; lean_object* x_153;
lean_dec(x_131);
lean_dec(x_130);
lean_dec(x_129);
lean_dec(x_124);
lean_dec(x_118);
lean_dec(x_115);
x_150 = lean_ctor_get(x_134, 0);
lean_inc(x_150);
x_151 = lean_ctor_get(x_134, 1);
lean_inc(x_151);
if (lean_is_exclusive(x_134)) {
lean_ctor_release(x_134, 0);
lean_ctor_release(x_134, 1);
x_152 = x_134;
} else {
lean_dec_ref(x_134);
x_152 = lean_box(0);
}
if (lean_is_scalar(x_152)) {
x_153 = lean_alloc_ctor(1, 2, 0);
} else {
x_153 = x_152;
}
lean_ctor_set(x_153, 0, x_150);
lean_ctor_set(x_153, 1, x_151);
return x_153;
}
}
else
{
lean_object* x_154; lean_object* x_155; lean_object* x_156; lean_object* x_157;
lean_dec(x_118);
lean_dec(x_115);
lean_dec(x_110);
lean_dec(x_109);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_154 = lean_ctor_get(x_120, 0);
lean_inc(x_154);
x_155 = lean_ctor_get(x_120, 1);
lean_inc(x_155);
if (lean_is_exclusive(x_120)) {
lean_ctor_release(x_120, 0);
lean_ctor_release(x_120, 1);
x_156 = x_120;
} else {
lean_dec_ref(x_120);
x_156 = lean_box(0);
}
if (lean_is_scalar(x_156)) {
x_157 = lean_alloc_ctor(1, 2, 0);
} else {
x_157 = x_156;
}
lean_ctor_set(x_157, 0, x_154);
lean_ctor_set(x_157, 1, x_155);
return x_157;
}
}
else
{
lean_object* x_158; lean_object* x_159; lean_object* x_160; lean_object* x_161;
lean_dec(x_115);
lean_dec(x_110);
lean_dec(x_109);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_158 = lean_ctor_get(x_117, 0);
lean_inc(x_158);
x_159 = lean_ctor_get(x_117, 1);
lean_inc(x_159);
if (lean_is_exclusive(x_117)) {
lean_ctor_release(x_117, 0);
lean_ctor_release(x_117, 1);
x_160 = x_117;
} else {
lean_dec_ref(x_117);
x_160 = lean_box(0);
}
if (lean_is_scalar(x_160)) {
x_161 = lean_alloc_ctor(1, 2, 0);
} else {
x_161 = x_160;
}
lean_ctor_set(x_161, 0, x_158);
lean_ctor_set(x_161, 1, x_159);
return x_161;
}
}
else
{
lean_object* x_162; lean_object* x_163; lean_object* x_164; lean_object* x_165;
lean_dec(x_110);
lean_dec(x_109);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_162 = lean_ctor_get(x_114, 0);
lean_inc(x_162);
x_163 = lean_ctor_get(x_114, 1);
lean_inc(x_163);
if (lean_is_exclusive(x_114)) {
lean_ctor_release(x_114, 0);
lean_ctor_release(x_114, 1);
x_164 = x_114;
} else {
lean_dec_ref(x_114);
x_164 = lean_box(0);
}
if (lean_is_scalar(x_164)) {
x_165 = lean_alloc_ctor(1, 2, 0);
} else {
x_165 = x_164;
}
lean_ctor_set(x_165, 0, x_162);
lean_ctor_set(x_165, 1, x_163);
return x_165;
}
}
}
else
{
uint8_t x_166;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_166 = !lean_is_exclusive(x_10);
if (x_166 == 0)
{
return x_10;
}
else
{
lean_object* x_167; lean_object* x_168; lean_object* x_169;
x_167 = lean_ctor_get(x_10, 0);
x_168 = lean_ctor_get(x_10, 1);
lean_inc(x_168);
lean_inc(x_167);
lean_dec(x_10);
x_169 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_169, 0, x_167);
lean_ctor_set(x_169, 1, x_168);
return x_169;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Data_AC_removeNeutrals_loop___at_Lean_Meta_AC_buildNormProof___spec__3___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Data_AC_removeNeutrals_loop___at_Lean_Meta_AC_buildNormProof___spec__3(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Data_AC_removeNeutrals___at_Lean_Meta_AC_buildNormProof___spec__2___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Data_AC_removeNeutrals___at_Lean_Meta_AC_buildNormProof___spec__2(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Data_AC_norm___at_Lean_Meta_AC_buildNormProof___spec__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Data_AC_norm___at_Lean_Meta_AC_buildNormProof___spec__1(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Data_AC_evalList___at_Lean_Meta_AC_buildNormProof___spec__4___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Data_AC_evalList___at_Lean_Meta_AC_buildNormProof___spec__4(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized_post___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13;
lean_inc(x_11);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
x_13 = l_Lean_Meta_AC_preContext(x_1, x_8, x_9, x_10, x_11, x_12);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
if (lean_obj_tag(x_14) == 0)
{
uint8_t x_15;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_4);
lean_dec(x_3);
x_15 = !lean_is_exclusive(x_13);
if (x_15 == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_16 = lean_ctor_get(x_13, 0);
lean_dec(x_16);
x_17 = lean_box(0);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_2);
lean_ctor_set(x_18, 1, x_17);
x_19 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_13, 0, x_19);
return x_13;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_20 = lean_ctor_get(x_13, 1);
lean_inc(x_20);
lean_dec(x_13);
x_21 = lean_box(0);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_2);
lean_ctor_set(x_22, 1, x_21);
x_23 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_23, 0, x_22);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_20);
return x_24;
}
}
else
{
lean_object* x_25; uint8_t x_26;
lean_dec(x_2);
x_25 = lean_ctor_get(x_13, 1);
lean_inc(x_25);
lean_dec(x_13);
x_26 = !lean_is_exclusive(x_14);
if (x_26 == 0)
{
lean_object* x_27; lean_object* x_28;
x_27 = lean_ctor_get(x_14, 0);
x_28 = l_Lean_Meta_AC_buildNormProof(x_27, x_3, x_4, x_8, x_9, x_10, x_11, x_25);
if (lean_obj_tag(x_28) == 0)
{
uint8_t x_29;
x_29 = !lean_is_exclusive(x_28);
if (x_29 == 0)
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_30 = lean_ctor_get(x_28, 0);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
lean_ctor_set(x_14, 0, x_31);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_33, 1, x_14);
x_34 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_28, 0, x_34);
return x_28;
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41;
x_35 = lean_ctor_get(x_28, 0);
x_36 = lean_ctor_get(x_28, 1);
lean_inc(x_36);
lean_inc(x_35);
lean_dec(x_28);
x_37 = lean_ctor_get(x_35, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_35, 1);
lean_inc(x_38);
lean_dec(x_35);
lean_ctor_set(x_14, 0, x_37);
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_39, 1, x_14);
x_40 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_40, 0, x_39);
x_41 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_41, 0, x_40);
lean_ctor_set(x_41, 1, x_36);
return x_41;
}
}
else
{
uint8_t x_42;
lean_free_object(x_14);
x_42 = !lean_is_exclusive(x_28);
if (x_42 == 0)
{
return x_28;
}
else
{
lean_object* x_43; lean_object* x_44; lean_object* x_45;
x_43 = lean_ctor_get(x_28, 0);
x_44 = lean_ctor_get(x_28, 1);
lean_inc(x_44);
lean_inc(x_43);
lean_dec(x_28);
x_45 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_45, 0, x_43);
lean_ctor_set(x_45, 1, x_44);
return x_45;
}
}
}
else
{
lean_object* x_46; lean_object* x_47;
x_46 = lean_ctor_get(x_14, 0);
lean_inc(x_46);
lean_dec(x_14);
x_47 = l_Lean_Meta_AC_buildNormProof(x_46, x_3, x_4, x_8, x_9, x_10, x_11, x_25);
if (lean_obj_tag(x_47) == 0)
{
lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56;
x_48 = lean_ctor_get(x_47, 0);
lean_inc(x_48);
x_49 = lean_ctor_get(x_47, 1);
lean_inc(x_49);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
lean_ctor_release(x_47, 1);
x_50 = x_47;
} else {
lean_dec_ref(x_47);
x_50 = lean_box(0);
}
x_51 = lean_ctor_get(x_48, 0);
lean_inc(x_51);
x_52 = lean_ctor_get(x_48, 1);
lean_inc(x_52);
lean_dec(x_48);
x_53 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_53, 0, x_51);
x_54 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_54, 0, x_52);
lean_ctor_set(x_54, 1, x_53);
x_55 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_55, 0, x_54);
if (lean_is_scalar(x_50)) {
x_56 = lean_alloc_ctor(0, 2, 0);
} else {
x_56 = x_50;
}
lean_ctor_set(x_56, 0, x_55);
lean_ctor_set(x_56, 1, x_49);
return x_56;
}
else
{
lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60;
x_57 = lean_ctor_get(x_47, 0);
lean_inc(x_57);
x_58 = lean_ctor_get(x_47, 1);
lean_inc(x_58);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
lean_ctor_release(x_47, 1);
x_59 = x_47;
} else {
lean_dec_ref(x_47);
x_59 = lean_box(0);
}
if (lean_is_scalar(x_59)) {
x_60 = lean_alloc_ctor(1, 2, 0);
} else {
x_60 = x_59;
}
lean_ctor_set(x_60, 0, x_57);
lean_ctor_set(x_60, 1, x_58);
return x_60;
}
}
}
}
else
{
uint8_t x_61;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_61 = !lean_is_exclusive(x_13);
if (x_61 == 0)
{
return x_13;
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64;
x_62 = lean_ctor_get(x_13, 0);
x_63 = lean_ctor_get(x_13, 1);
lean_inc(x_63);
lean_inc(x_62);
lean_dec(x_13);
x_64 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_64, 0, x_62);
lean_ctor_set(x_64, 1, x_63);
return x_64;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized_post(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
if (lean_obj_tag(x_1) == 5)
{
lean_object* x_9;
x_9 = lean_ctor_get(x_1, 0);
lean_inc(x_9);
if (lean_obj_tag(x_9) == 5)
{
lean_object* x_10;
x_10 = lean_ctor_get(x_2, 3);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
lean_dec(x_3);
lean_dec(x_2);
x_11 = lean_ctor_get(x_1, 1);
lean_inc(x_11);
x_12 = lean_ctor_get(x_9, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_9, 1);
lean_inc(x_13);
lean_dec(x_9);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_14 = l_Lean_Meta_AC_preContext(x_12, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_14) == 0)
{
lean_object* x_15;
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_16;
lean_dec(x_13);
lean_dec(x_11);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_16 = !lean_is_exclusive(x_14);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_17 = lean_ctor_get(x_14, 0);
lean_dec(x_17);
x_18 = lean_box(0);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_1);
lean_ctor_set(x_19, 1, x_18);
x_20 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_14, 0, x_20);
return x_14;
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_21 = lean_ctor_get(x_14, 1);
lean_inc(x_21);
lean_dec(x_14);
x_22 = lean_box(0);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_1);
lean_ctor_set(x_23, 1, x_22);
x_24 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_24, 0, x_23);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_21);
return x_25;
}
}
else
{
lean_object* x_26; uint8_t x_27;
lean_dec(x_1);
x_26 = lean_ctor_get(x_14, 1);
lean_inc(x_26);
lean_dec(x_14);
x_27 = !lean_is_exclusive(x_15);
if (x_27 == 0)
{
lean_object* x_28; lean_object* x_29;
x_28 = lean_ctor_get(x_15, 0);
x_29 = l_Lean_Meta_AC_buildNormProof(x_28, x_13, x_11, x_4, x_5, x_6, x_7, x_26);
if (lean_obj_tag(x_29) == 0)
{
uint8_t x_30;
x_30 = !lean_is_exclusive(x_29);
if (x_30 == 0)
{
lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_31 = lean_ctor_get(x_29, 0);
x_32 = lean_ctor_get(x_31, 0);
lean_inc(x_32);
x_33 = lean_ctor_get(x_31, 1);
lean_inc(x_33);
lean_dec(x_31);
lean_ctor_set(x_15, 0, x_32);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_15);
x_35 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_35, 0, x_34);
lean_ctor_set(x_29, 0, x_35);
return x_29;
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_36 = lean_ctor_get(x_29, 0);
x_37 = lean_ctor_get(x_29, 1);
lean_inc(x_37);
lean_inc(x_36);
lean_dec(x_29);
x_38 = lean_ctor_get(x_36, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_36, 1);
lean_inc(x_39);
lean_dec(x_36);
lean_ctor_set(x_15, 0, x_38);
x_40 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_40, 1, x_15);
x_41 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_41, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_37);
return x_42;
}
}
else
{
uint8_t x_43;
lean_free_object(x_15);
x_43 = !lean_is_exclusive(x_29);
if (x_43 == 0)
{
return x_29;
}
else
{
lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_44 = lean_ctor_get(x_29, 0);
x_45 = lean_ctor_get(x_29, 1);
lean_inc(x_45);
lean_inc(x_44);
lean_dec(x_29);
x_46 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_46, 0, x_44);
lean_ctor_set(x_46, 1, x_45);
return x_46;
}
}
}
else
{
lean_object* x_47; lean_object* x_48;
x_47 = lean_ctor_get(x_15, 0);
lean_inc(x_47);
lean_dec(x_15);
x_48 = l_Lean_Meta_AC_buildNormProof(x_47, x_13, x_11, x_4, x_5, x_6, x_7, x_26);
if (lean_obj_tag(x_48) == 0)
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_49 = lean_ctor_get(x_48, 0);
lean_inc(x_49);
x_50 = lean_ctor_get(x_48, 1);
lean_inc(x_50);
if (lean_is_exclusive(x_48)) {
lean_ctor_release(x_48, 0);
lean_ctor_release(x_48, 1);
x_51 = x_48;
} else {
lean_dec_ref(x_48);
x_51 = lean_box(0);
}
x_52 = lean_ctor_get(x_49, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_49, 1);
lean_inc(x_53);
lean_dec(x_49);
x_54 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_54, 0, x_52);
x_55 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_55, 0, x_53);
lean_ctor_set(x_55, 1, x_54);
x_56 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_56, 0, x_55);
if (lean_is_scalar(x_51)) {
x_57 = lean_alloc_ctor(0, 2, 0);
} else {
x_57 = x_51;
}
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_57, 1, x_50);
return x_57;
}
else
{
lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61;
x_58 = lean_ctor_get(x_48, 0);
lean_inc(x_58);
x_59 = lean_ctor_get(x_48, 1);
lean_inc(x_59);
if (lean_is_exclusive(x_48)) {
lean_ctor_release(x_48, 0);
lean_ctor_release(x_48, 1);
x_60 = x_48;
} else {
lean_dec_ref(x_48);
x_60 = lean_box(0);
}
if (lean_is_scalar(x_60)) {
x_61 = lean_alloc_ctor(1, 2, 0);
} else {
x_61 = x_60;
}
lean_ctor_set(x_61, 0, x_58);
lean_ctor_set(x_61, 1, x_59);
return x_61;
}
}
}
}
else
{
uint8_t x_62;
lean_dec(x_13);
lean_dec(x_11);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_62 = !lean_is_exclusive(x_14);
if (x_62 == 0)
{
return x_14;
}
else
{
lean_object* x_63; lean_object* x_64; lean_object* x_65;
x_63 = lean_ctor_get(x_14, 0);
x_64 = lean_ctor_get(x_14, 1);
lean_inc(x_64);
lean_inc(x_63);
lean_dec(x_14);
x_65 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_65, 0, x_63);
lean_ctor_set(x_65, 1, x_64);
return x_65;
}
}
}
else
{
lean_object* x_66;
x_66 = lean_ctor_get(x_10, 0);
lean_inc(x_66);
lean_dec(x_10);
if (lean_obj_tag(x_66) == 5)
{
lean_object* x_67;
x_67 = lean_ctor_get(x_66, 0);
lean_inc(x_67);
lean_dec(x_66);
if (lean_obj_tag(x_67) == 5)
{
lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72;
x_68 = lean_ctor_get(x_1, 1);
lean_inc(x_68);
x_69 = lean_ctor_get(x_9, 0);
lean_inc(x_69);
x_70 = lean_ctor_get(x_9, 1);
lean_inc(x_70);
lean_dec(x_9);
x_71 = lean_ctor_get(x_67, 0);
lean_inc(x_71);
lean_dec(x_67);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_69);
x_72 = l_Lean_Meta_isExprDefEq(x_69, x_71, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_72) == 0)
{
lean_object* x_73; uint8_t x_74;
x_73 = lean_ctor_get(x_72, 0);
lean_inc(x_73);
x_74 = lean_unbox(x_73);
lean_dec(x_73);
if (x_74 == 0)
{
lean_object* x_75; lean_object* x_76; lean_object* x_77;
x_75 = lean_ctor_get(x_72, 1);
lean_inc(x_75);
lean_dec(x_72);
x_76 = lean_box(0);
x_77 = l_Lean_Meta_AC_rewriteUnnormalized_post___lambda__1(x_69, x_1, x_70, x_68, x_76, x_2, x_3, x_4, x_5, x_6, x_7, x_75);
lean_dec(x_3);
lean_dec(x_2);
return x_77;
}
else
{
uint8_t x_78;
lean_dec(x_70);
lean_dec(x_69);
lean_dec(x_68);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_78 = !lean_is_exclusive(x_72);
if (x_78 == 0)
{
lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82;
x_79 = lean_ctor_get(x_72, 0);
lean_dec(x_79);
x_80 = lean_box(0);
x_81 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_81, 0, x_1);
lean_ctor_set(x_81, 1, x_80);
x_82 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_82, 0, x_81);
lean_ctor_set(x_72, 0, x_82);
return x_72;
}
else
{
lean_object* x_83; lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87;
x_83 = lean_ctor_get(x_72, 1);
lean_inc(x_83);
lean_dec(x_72);
x_84 = lean_box(0);
x_85 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_85, 0, x_1);
lean_ctor_set(x_85, 1, x_84);
x_86 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_86, 0, x_85);
x_87 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_87, 0, x_86);
lean_ctor_set(x_87, 1, x_83);
return x_87;
}
}
}
else
{
uint8_t x_88;
lean_dec(x_70);
lean_dec(x_69);
lean_dec(x_68);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_88 = !lean_is_exclusive(x_72);
if (x_88 == 0)
{
return x_72;
}
else
{
lean_object* x_89; lean_object* x_90; lean_object* x_91;
x_89 = lean_ctor_get(x_72, 0);
x_90 = lean_ctor_get(x_72, 1);
lean_inc(x_90);
lean_inc(x_89);
lean_dec(x_72);
x_91 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_91, 0, x_89);
lean_ctor_set(x_91, 1, x_90);
return x_91;
}
}
}
else
{
lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95;
lean_dec(x_67);
lean_dec(x_3);
lean_dec(x_2);
x_92 = lean_ctor_get(x_1, 1);
lean_inc(x_92);
x_93 = lean_ctor_get(x_9, 0);
lean_inc(x_93);
x_94 = lean_ctor_get(x_9, 1);
lean_inc(x_94);
lean_dec(x_9);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_95 = l_Lean_Meta_AC_preContext(x_93, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_95) == 0)
{
lean_object* x_96;
x_96 = lean_ctor_get(x_95, 0);
lean_inc(x_96);
if (lean_obj_tag(x_96) == 0)
{
uint8_t x_97;
lean_dec(x_94);
lean_dec(x_92);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_97 = !lean_is_exclusive(x_95);
if (x_97 == 0)
{
lean_object* x_98; lean_object* x_99; lean_object* x_100; lean_object* x_101;
x_98 = lean_ctor_get(x_95, 0);
lean_dec(x_98);
x_99 = lean_box(0);
x_100 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_100, 0, x_1);
lean_ctor_set(x_100, 1, x_99);
x_101 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_101, 0, x_100);
lean_ctor_set(x_95, 0, x_101);
return x_95;
}
else
{
lean_object* x_102; lean_object* x_103; lean_object* x_104; lean_object* x_105; lean_object* x_106;
x_102 = lean_ctor_get(x_95, 1);
lean_inc(x_102);
lean_dec(x_95);
x_103 = lean_box(0);
x_104 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_104, 0, x_1);
lean_ctor_set(x_104, 1, x_103);
x_105 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_105, 0, x_104);
x_106 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_106, 0, x_105);
lean_ctor_set(x_106, 1, x_102);
return x_106;
}
}
else
{
lean_object* x_107; uint8_t x_108;
lean_dec(x_1);
x_107 = lean_ctor_get(x_95, 1);
lean_inc(x_107);
lean_dec(x_95);
x_108 = !lean_is_exclusive(x_96);
if (x_108 == 0)
{
lean_object* x_109; lean_object* x_110;
x_109 = lean_ctor_get(x_96, 0);
x_110 = l_Lean_Meta_AC_buildNormProof(x_109, x_94, x_92, x_4, x_5, x_6, x_7, x_107);
if (lean_obj_tag(x_110) == 0)
{
uint8_t x_111;
x_111 = !lean_is_exclusive(x_110);
if (x_111 == 0)
{
lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116;
x_112 = lean_ctor_get(x_110, 0);
x_113 = lean_ctor_get(x_112, 0);
lean_inc(x_113);
x_114 = lean_ctor_get(x_112, 1);
lean_inc(x_114);
lean_dec(x_112);
lean_ctor_set(x_96, 0, x_113);
x_115 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_115, 0, x_114);
lean_ctor_set(x_115, 1, x_96);
x_116 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_116, 0, x_115);
lean_ctor_set(x_110, 0, x_116);
return x_110;
}
else
{
lean_object* x_117; lean_object* x_118; lean_object* x_119; lean_object* x_120; lean_object* x_121; lean_object* x_122; lean_object* x_123;
x_117 = lean_ctor_get(x_110, 0);
x_118 = lean_ctor_get(x_110, 1);
lean_inc(x_118);
lean_inc(x_117);
lean_dec(x_110);
x_119 = lean_ctor_get(x_117, 0);
lean_inc(x_119);
x_120 = lean_ctor_get(x_117, 1);
lean_inc(x_120);
lean_dec(x_117);
lean_ctor_set(x_96, 0, x_119);
x_121 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_121, 0, x_120);
lean_ctor_set(x_121, 1, x_96);
x_122 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_122, 0, x_121);
x_123 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_123, 0, x_122);
lean_ctor_set(x_123, 1, x_118);
return x_123;
}
}
else
{
uint8_t x_124;
lean_free_object(x_96);
x_124 = !lean_is_exclusive(x_110);
if (x_124 == 0)
{
return x_110;
}
else
{
lean_object* x_125; lean_object* x_126; lean_object* x_127;
x_125 = lean_ctor_get(x_110, 0);
x_126 = lean_ctor_get(x_110, 1);
lean_inc(x_126);
lean_inc(x_125);
lean_dec(x_110);
x_127 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_127, 0, x_125);
lean_ctor_set(x_127, 1, x_126);
return x_127;
}
}
}
else
{
lean_object* x_128; lean_object* x_129;
x_128 = lean_ctor_get(x_96, 0);
lean_inc(x_128);
lean_dec(x_96);
x_129 = l_Lean_Meta_AC_buildNormProof(x_128, x_94, x_92, x_4, x_5, x_6, x_7, x_107);
if (lean_obj_tag(x_129) == 0)
{
lean_object* x_130; lean_object* x_131; lean_object* x_132; lean_object* x_133; lean_object* x_134; lean_object* x_135; lean_object* x_136; lean_object* x_137; lean_object* x_138;
x_130 = lean_ctor_get(x_129, 0);
lean_inc(x_130);
x_131 = lean_ctor_get(x_129, 1);
lean_inc(x_131);
if (lean_is_exclusive(x_129)) {
lean_ctor_release(x_129, 0);
lean_ctor_release(x_129, 1);
x_132 = x_129;
} else {
lean_dec_ref(x_129);
x_132 = lean_box(0);
}
x_133 = lean_ctor_get(x_130, 0);
lean_inc(x_133);
x_134 = lean_ctor_get(x_130, 1);
lean_inc(x_134);
lean_dec(x_130);
x_135 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_135, 0, x_133);
x_136 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_136, 0, x_134);
lean_ctor_set(x_136, 1, x_135);
x_137 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_137, 0, x_136);
if (lean_is_scalar(x_132)) {
x_138 = lean_alloc_ctor(0, 2, 0);
} else {
x_138 = x_132;
}
lean_ctor_set(x_138, 0, x_137);
lean_ctor_set(x_138, 1, x_131);
return x_138;
}
else
{
lean_object* x_139; lean_object* x_140; lean_object* x_141; lean_object* x_142;
x_139 = lean_ctor_get(x_129, 0);
lean_inc(x_139);
x_140 = lean_ctor_get(x_129, 1);
lean_inc(x_140);
if (lean_is_exclusive(x_129)) {
lean_ctor_release(x_129, 0);
lean_ctor_release(x_129, 1);
x_141 = x_129;
} else {
lean_dec_ref(x_129);
x_141 = lean_box(0);
}
if (lean_is_scalar(x_141)) {
x_142 = lean_alloc_ctor(1, 2, 0);
} else {
x_142 = x_141;
}
lean_ctor_set(x_142, 0, x_139);
lean_ctor_set(x_142, 1, x_140);
return x_142;
}
}
}
}
else
{
uint8_t x_143;
lean_dec(x_94);
lean_dec(x_92);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_143 = !lean_is_exclusive(x_95);
if (x_143 == 0)
{
return x_95;
}
else
{
lean_object* x_144; lean_object* x_145; lean_object* x_146;
x_144 = lean_ctor_get(x_95, 0);
x_145 = lean_ctor_get(x_95, 1);
lean_inc(x_145);
lean_inc(x_144);
lean_dec(x_95);
x_146 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_146, 0, x_144);
lean_ctor_set(x_146, 1, x_145);
return x_146;
}
}
}
}
else
{
lean_object* x_147; lean_object* x_148; lean_object* x_149; lean_object* x_150;
lean_dec(x_66);
lean_dec(x_3);
lean_dec(x_2);
x_147 = lean_ctor_get(x_1, 1);
lean_inc(x_147);
x_148 = lean_ctor_get(x_9, 0);
lean_inc(x_148);
x_149 = lean_ctor_get(x_9, 1);
lean_inc(x_149);
lean_dec(x_9);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_150 = l_Lean_Meta_AC_preContext(x_148, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_150) == 0)
{
lean_object* x_151;
x_151 = lean_ctor_get(x_150, 0);
lean_inc(x_151);
if (lean_obj_tag(x_151) == 0)
{
uint8_t x_152;
lean_dec(x_149);
lean_dec(x_147);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_152 = !lean_is_exclusive(x_150);
if (x_152 == 0)
{
lean_object* x_153; lean_object* x_154; lean_object* x_155; lean_object* x_156;
x_153 = lean_ctor_get(x_150, 0);
lean_dec(x_153);
x_154 = lean_box(0);
x_155 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_155, 0, x_1);
lean_ctor_set(x_155, 1, x_154);
x_156 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_156, 0, x_155);
lean_ctor_set(x_150, 0, x_156);
return x_150;
}
else
{
lean_object* x_157; lean_object* x_158; lean_object* x_159; lean_object* x_160; lean_object* x_161;
x_157 = lean_ctor_get(x_150, 1);
lean_inc(x_157);
lean_dec(x_150);
x_158 = lean_box(0);
x_159 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_159, 0, x_1);
lean_ctor_set(x_159, 1, x_158);
x_160 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_160, 0, x_159);
x_161 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_161, 0, x_160);
lean_ctor_set(x_161, 1, x_157);
return x_161;
}
}
else
{
lean_object* x_162; uint8_t x_163;
lean_dec(x_1);
x_162 = lean_ctor_get(x_150, 1);
lean_inc(x_162);
lean_dec(x_150);
x_163 = !lean_is_exclusive(x_151);
if (x_163 == 0)
{
lean_object* x_164; lean_object* x_165;
x_164 = lean_ctor_get(x_151, 0);
x_165 = l_Lean_Meta_AC_buildNormProof(x_164, x_149, x_147, x_4, x_5, x_6, x_7, x_162);
if (lean_obj_tag(x_165) == 0)
{
uint8_t x_166;
x_166 = !lean_is_exclusive(x_165);
if (x_166 == 0)
{
lean_object* x_167; lean_object* x_168; lean_object* x_169; lean_object* x_170; lean_object* x_171;
x_167 = lean_ctor_get(x_165, 0);
x_168 = lean_ctor_get(x_167, 0);
lean_inc(x_168);
x_169 = lean_ctor_get(x_167, 1);
lean_inc(x_169);
lean_dec(x_167);
lean_ctor_set(x_151, 0, x_168);
x_170 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_170, 0, x_169);
lean_ctor_set(x_170, 1, x_151);
x_171 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_171, 0, x_170);
lean_ctor_set(x_165, 0, x_171);
return x_165;
}
else
{
lean_object* x_172; lean_object* x_173; lean_object* x_174; lean_object* x_175; lean_object* x_176; lean_object* x_177; lean_object* x_178;
x_172 = lean_ctor_get(x_165, 0);
x_173 = lean_ctor_get(x_165, 1);
lean_inc(x_173);
lean_inc(x_172);
lean_dec(x_165);
x_174 = lean_ctor_get(x_172, 0);
lean_inc(x_174);
x_175 = lean_ctor_get(x_172, 1);
lean_inc(x_175);
lean_dec(x_172);
lean_ctor_set(x_151, 0, x_174);
x_176 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_176, 0, x_175);
lean_ctor_set(x_176, 1, x_151);
x_177 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_177, 0, x_176);
x_178 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_178, 0, x_177);
lean_ctor_set(x_178, 1, x_173);
return x_178;
}
}
else
{
uint8_t x_179;
lean_free_object(x_151);
x_179 = !lean_is_exclusive(x_165);
if (x_179 == 0)
{
return x_165;
}
else
{
lean_object* x_180; lean_object* x_181; lean_object* x_182;
x_180 = lean_ctor_get(x_165, 0);
x_181 = lean_ctor_get(x_165, 1);
lean_inc(x_181);
lean_inc(x_180);
lean_dec(x_165);
x_182 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_182, 0, x_180);
lean_ctor_set(x_182, 1, x_181);
return x_182;
}
}
}
else
{
lean_object* x_183; lean_object* x_184;
x_183 = lean_ctor_get(x_151, 0);
lean_inc(x_183);
lean_dec(x_151);
x_184 = l_Lean_Meta_AC_buildNormProof(x_183, x_149, x_147, x_4, x_5, x_6, x_7, x_162);
if (lean_obj_tag(x_184) == 0)
{
lean_object* x_185; lean_object* x_186; lean_object* x_187; lean_object* x_188; lean_object* x_189; lean_object* x_190; lean_object* x_191; lean_object* x_192; lean_object* x_193;
x_185 = lean_ctor_get(x_184, 0);
lean_inc(x_185);
x_186 = lean_ctor_get(x_184, 1);
lean_inc(x_186);
if (lean_is_exclusive(x_184)) {
lean_ctor_release(x_184, 0);
lean_ctor_release(x_184, 1);
x_187 = x_184;
} else {
lean_dec_ref(x_184);
x_187 = lean_box(0);
}
x_188 = lean_ctor_get(x_185, 0);
lean_inc(x_188);
x_189 = lean_ctor_get(x_185, 1);
lean_inc(x_189);
lean_dec(x_185);
x_190 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_190, 0, x_188);
x_191 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_191, 0, x_189);
lean_ctor_set(x_191, 1, x_190);
x_192 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_192, 0, x_191);
if (lean_is_scalar(x_187)) {
x_193 = lean_alloc_ctor(0, 2, 0);
} else {
x_193 = x_187;
}
lean_ctor_set(x_193, 0, x_192);
lean_ctor_set(x_193, 1, x_186);
return x_193;
}
else
{
lean_object* x_194; lean_object* x_195; lean_object* x_196; lean_object* x_197;
x_194 = lean_ctor_get(x_184, 0);
lean_inc(x_194);
x_195 = lean_ctor_get(x_184, 1);
lean_inc(x_195);
if (lean_is_exclusive(x_184)) {
lean_ctor_release(x_184, 0);
lean_ctor_release(x_184, 1);
x_196 = x_184;
} else {
lean_dec_ref(x_184);
x_196 = lean_box(0);
}
if (lean_is_scalar(x_196)) {
x_197 = lean_alloc_ctor(1, 2, 0);
} else {
x_197 = x_196;
}
lean_ctor_set(x_197, 0, x_194);
lean_ctor_set(x_197, 1, x_195);
return x_197;
}
}
}
}
else
{
uint8_t x_198;
lean_dec(x_149);
lean_dec(x_147);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_198 = !lean_is_exclusive(x_150);
if (x_198 == 0)
{
return x_150;
}
else
{
lean_object* x_199; lean_object* x_200; lean_object* x_201;
x_199 = lean_ctor_get(x_150, 0);
x_200 = lean_ctor_get(x_150, 1);
lean_inc(x_200);
lean_inc(x_199);
lean_dec(x_150);
x_201 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_201, 0, x_199);
lean_ctor_set(x_201, 1, x_200);
return x_201;
}
}
}
}
}
else
{
lean_object* x_202; lean_object* x_203; lean_object* x_204; lean_object* x_205;
lean_dec(x_9);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_202 = lean_box(0);
x_203 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_203, 0, x_1);
lean_ctor_set(x_203, 1, x_202);
x_204 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_204, 0, x_203);
x_205 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_205, 0, x_204);
lean_ctor_set(x_205, 1, x_8);
return x_205;
}
}
else
{
lean_object* x_206; lean_object* x_207; lean_object* x_208; lean_object* x_209;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_206 = lean_box(0);
x_207 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_207, 0, x_1);
lean_ctor_set(x_207, 1, x_206);
x_208 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_208, 0, x_207);
x_209 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_209, 0, x_208);
lean_ctor_set(x_209, 1, x_8);
return x_209;
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized_post___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13;
x_13 = l_Lean_Meta_AC_rewriteUnnormalized_post___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10, x_11, x_12);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_2);
lean_ctor_set(x_10, 1, x_1);
x_11 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_11, 0, x_10);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_9);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10;
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_1);
lean_ctor_set(x_10, 1, x_9);
return x_10;
}
}
static lean_object* _init_l_Lean_Meta_AC_rewriteUnnormalized___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_AC_rewriteUnnormalized_post), 8, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_rewriteUnnormalized___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("refl failed", 11);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_AC_rewriteUnnormalized___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Meta_AC_rewriteUnnormalized___closed__2;
x_2 = lean_alloc_ctor(2, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Meta_AC_rewriteUnnormalized___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Meta_AC_rewriteUnnormalized___closed__3;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_7 = l_Lean_Meta_getSimpCongrTheorems___rarg(x_5, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = lean_box(0);
x_11 = l_Lean_Meta_Simp_neutralConfig;
x_12 = l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1___closed__1;
x_13 = lean_unsigned_to_nat(0u);
x_14 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_14, 0, x_11);
lean_ctor_set(x_14, 1, x_12);
lean_ctor_set(x_14, 2, x_8);
lean_ctor_set(x_14, 3, x_10);
lean_ctor_set(x_14, 4, x_13);
lean_inc(x_1);
x_15 = l_Lean_Meta_getMVarType(x_1, x_2, x_3, x_4, x_5, x_9);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_alloc_closure((void*)(l_Lean_Meta_AC_rewriteUnnormalized___lambda__1___boxed), 9, 1);
lean_closure_set(x_18, 0, x_10);
x_19 = lean_alloc_closure((void*)(l_Lean_Meta_AC_rewriteUnnormalized___lambda__2___boxed), 9, 1);
lean_closure_set(x_19, 0, x_10);
x_20 = l_Lean_Meta_AC_rewriteUnnormalized___closed__1;
x_21 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_21, 0, x_18);
lean_ctor_set(x_21, 1, x_20);
lean_ctor_set(x_21, 2, x_19);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_3);
lean_inc(x_2);
lean_inc(x_16);
x_22 = l_Lean_Meta_Simp_main(x_16, x_14, x_21, x_2, x_3, x_4, x_5, x_17);
if (lean_obj_tag(x_22) == 0)
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_3);
lean_inc(x_2);
x_25 = l_Lean_Meta_applySimpResultToTarget(x_1, x_16, x_23, x_2, x_3, x_4, x_5, x_24);
lean_dec(x_16);
if (lean_obj_tag(x_25) == 0)
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
x_27 = lean_ctor_get(x_25, 1);
lean_inc(x_27);
lean_dec(x_25);
x_28 = l_Lean_Meta_AC_rewriteUnnormalized___closed__4;
x_29 = l_Lean_Meta_applyRefl(x_26, x_28, x_2, x_3, x_4, x_5, x_27);
return x_29;
}
else
{
uint8_t x_30;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_30 = !lean_is_exclusive(x_25);
if (x_30 == 0)
{
return x_25;
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_31 = lean_ctor_get(x_25, 0);
x_32 = lean_ctor_get(x_25, 1);
lean_inc(x_32);
lean_inc(x_31);
lean_dec(x_25);
x_33 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_33, 0, x_31);
lean_ctor_set(x_33, 1, x_32);
return x_33;
}
}
}
else
{
uint8_t x_34;
lean_dec(x_16);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_34 = !lean_is_exclusive(x_22);
if (x_34 == 0)
{
return x_22;
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_35 = lean_ctor_get(x_22, 0);
x_36 = lean_ctor_get(x_22, 1);
lean_inc(x_36);
lean_inc(x_35);
lean_dec(x_22);
x_37 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_37, 0, x_35);
lean_ctor_set(x_37, 1, x_36);
return x_37;
}
}
}
else
{
uint8_t x_38;
lean_dec(x_14);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_38 = !lean_is_exclusive(x_15);
if (x_38 == 0)
{
return x_15;
}
else
{
lean_object* x_39; lean_object* x_40; lean_object* x_41;
x_39 = lean_ctor_get(x_15, 0);
x_40 = lean_ctor_get(x_15, 1);
lean_inc(x_40);
lean_inc(x_39);
lean_dec(x_15);
x_41 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_41, 0, x_39);
lean_ctor_set(x_41, 1, x_40);
return x_41;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10;
x_10 = l_Lean_Meta_AC_rewriteUnnormalized___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_rewriteUnnormalized___lambda__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10;
x_10 = l_Lean_Meta_AC_rewriteUnnormalized___lambda__2(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_ac__refl__tactic___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10;
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
x_10 = l_Lean_Elab_Tactic_getMainGoal(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9);
if (lean_obj_tag(x_10) == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_Meta_AC_rewriteUnnormalized(x_11, x_5, x_6, x_7, x_8, x_12);
return x_13;
}
else
{
uint8_t x_14;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_14 = !lean_is_exclusive(x_10);
if (x_14 == 0)
{
return x_10;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_15 = lean_ctor_get(x_10, 0);
x_16 = lean_ctor_get(x_10, 1);
lean_inc(x_16);
lean_inc(x_15);
lean_dec(x_10);
x_17 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_17, 0, x_15);
lean_ctor_set(x_17, 1, x_16);
return x_17;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_ac__refl__tactic(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_Meta_AC_ac__refl__tactic___rarg), 9, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_ac__refl__tactic___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_Meta_AC_ac__refl__tactic(x_1);
lean_dec(x_1);
return x_2;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Parser", 6);
return x_1;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_preContext___closed__2;
x_2 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Tactic", 6);
return x_1;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__2;
x_2 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__3;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("ac_refl", 7);
return x_1;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__4;
x_2 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__5;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__7() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_Meta_AC_preContext___closed__2;
x_2 = l_Lean_Meta_AC_getInstance___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__7;
x_2 = l_Lean_Meta_AC_getInstance___closed__3;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__9() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("ac_refl_tactic", 14);
return x_1;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__8;
x_2 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__9;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__11() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_Elab_Tactic_tacticElabAttribute;
return x_1;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__12() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_AC_ac__refl__tactic___boxed), 1, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_2 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__11;
x_3 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__6;
x_4 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__10;
x_5 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__12;
x_6 = l_Lean_KeyedDeclsAttribute_addBuiltin___rarg(x_2, x_3, x_4, x_5, x_1);
return x_6;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_unsigned_to_nat(171u);
x_2 = lean_unsigned_to_nat(25u);
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_unsigned_to_nat(173u);
x_2 = lean_unsigned_to_nat(26u);
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__1;
x_2 = lean_unsigned_to_nat(25u);
x_3 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__2;
x_4 = lean_unsigned_to_nat(26u);
x_5 = lean_alloc_ctor(0, 4, 0);
lean_ctor_set(x_5, 0, x_1);
lean_ctor_set(x_5, 1, x_2);
lean_ctor_set(x_5, 2, x_3);
lean_ctor_set(x_5, 3, x_4);
return x_5;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_unsigned_to_nat(171u);
x_2 = lean_unsigned_to_nat(29u);
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_unsigned_to_nat(171u);
x_2 = lean_unsigned_to_nat(43u);
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__4;
x_2 = lean_unsigned_to_nat(29u);
x_3 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__5;
x_4 = lean_unsigned_to_nat(43u);
x_5 = lean_alloc_ctor(0, 4, 0);
lean_ctor_set(x_5, 0, x_1);
lean_ctor_set(x_5, 1, x_2);
lean_ctor_set(x_5, 2, x_3);
lean_ctor_set(x_5, 3, x_4);
return x_5;
}
}
static lean_object* _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__7() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__3;
x_2 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__6;
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_2 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__10;
x_3 = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__7;
x_4 = l_Lean_addBuiltinDeclarationRanges(x_2, x_3, x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_AC_initFn____x40_Lean_Meta_Tactic_AC_Main___hyg_2111_(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = l_Lean_Meta_AC_getInstance___closed__4;
x_3 = l_Lean_registerTraceClass(x_2, x_1);
return x_3;
}
}
lean_object* initialize_Init(uint8_t builtin, lean_object*);
lean_object* initialize_Init_Data_AC(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Meta_AppBuilder(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Elab_Tactic_Basic(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Elab_Tactic_Rewrite(uint8_t builtin, lean_object*);
static bool _G_initialized = false;
LEAN_EXPORT lean_object* initialize_Lean_Meta_Tactic_AC_Main(uint8_t builtin, lean_object* w) {
lean_object * res;
if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
_G_initialized = true;
res = initialize_Init(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Data_AC(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Meta_AppBuilder(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Elab_Tactic_Basic(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Elab_Tactic_Rewrite(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l_Lean_Meta_AC_instInhabitedPreContext___closed__1 = _init_l_Lean_Meta_AC_instInhabitedPreContext___closed__1();
l_Lean_Meta_AC_instInhabitedPreContext___closed__2 = _init_l_Lean_Meta_AC_instInhabitedPreContext___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_instInhabitedPreContext___closed__2);
l_Lean_Meta_AC_instInhabitedPreContext___closed__3 = _init_l_Lean_Meta_AC_instInhabitedPreContext___closed__3();
lean_mark_persistent(l_Lean_Meta_AC_instInhabitedPreContext___closed__3);
l_Lean_Meta_AC_instInhabitedPreContext = _init_l_Lean_Meta_AC_instInhabitedPreContext();
lean_mark_persistent(l_Lean_Meta_AC_instInhabitedPreContext);
l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__1 = _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__1);
l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__2 = _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__2);
l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__3 = _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__3();
lean_mark_persistent(l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__3);
l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__4 = _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__4();
lean_mark_persistent(l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool___closed__4);
l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool = _init_l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool();
lean_mark_persistent(l_Lean_Meta_AC_instContextInformationProdPreContextArrayBool);
l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___closed__1 = _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_instEvalInformationPreContextACExpr___lambda__1___closed__1);
l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__1 = _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__1);
l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__2 = _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__2);
l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__3 = _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__3();
lean_mark_persistent(l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__3);
l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__4 = _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__4();
lean_mark_persistent(l_Lean_Meta_AC_instEvalInformationPreContextACExpr___closed__4);
l_Lean_Meta_AC_instEvalInformationPreContextACExpr = _init_l_Lean_Meta_AC_instEvalInformationPreContextACExpr();
lean_mark_persistent(l_Lean_Meta_AC_instEvalInformationPreContextACExpr);
l_Lean_Meta_AC_getInstance___lambda__2___closed__1 = _init_l_Lean_Meta_AC_getInstance___lambda__2___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___lambda__2___closed__1);
l_Lean_Meta_AC_getInstance___lambda__2___closed__2 = _init_l_Lean_Meta_AC_getInstance___lambda__2___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___lambda__2___closed__2);
l_Lean_Meta_AC_getInstance___closed__1 = _init_l_Lean_Meta_AC_getInstance___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___closed__1);
l_Lean_Meta_AC_getInstance___closed__2 = _init_l_Lean_Meta_AC_getInstance___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___closed__2);
l_Lean_Meta_AC_getInstance___closed__3 = _init_l_Lean_Meta_AC_getInstance___closed__3();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___closed__3);
l_Lean_Meta_AC_getInstance___closed__4 = _init_l_Lean_Meta_AC_getInstance___closed__4();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___closed__4);
l_Lean_Meta_AC_getInstance___closed__5 = _init_l_Lean_Meta_AC_getInstance___closed__5();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___closed__5);
l_Lean_Meta_AC_getInstance___closed__6 = _init_l_Lean_Meta_AC_getInstance___closed__6();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___closed__6);
l_Lean_Meta_AC_getInstance___closed__7 = _init_l_Lean_Meta_AC_getInstance___closed__7();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___closed__7);
l_Lean_Meta_AC_getInstance___closed__8 = _init_l_Lean_Meta_AC_getInstance___closed__8();
lean_mark_persistent(l_Lean_Meta_AC_getInstance___closed__8);
l_Lean_Meta_AC_preContext___closed__1 = _init_l_Lean_Meta_AC_preContext___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__1);
l_Lean_Meta_AC_preContext___closed__2 = _init_l_Lean_Meta_AC_preContext___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__2);
l_Lean_Meta_AC_preContext___closed__3 = _init_l_Lean_Meta_AC_preContext___closed__3();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__3);
l_Lean_Meta_AC_preContext___closed__4 = _init_l_Lean_Meta_AC_preContext___closed__4();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__4);
l_Lean_Meta_AC_preContext___closed__5 = _init_l_Lean_Meta_AC_preContext___closed__5();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__5);
l_Lean_Meta_AC_preContext___closed__6 = _init_l_Lean_Meta_AC_preContext___closed__6();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__6);
l_Lean_Meta_AC_preContext___closed__7 = _init_l_Lean_Meta_AC_preContext___closed__7();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__7);
l_Lean_Meta_AC_preContext___closed__8 = _init_l_Lean_Meta_AC_preContext___closed__8();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__8);
l_Lean_Meta_AC_preContext___closed__9 = _init_l_Lean_Meta_AC_preContext___closed__9();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__9);
l_Lean_Meta_AC_preContext___closed__10 = _init_l_Lean_Meta_AC_preContext___closed__10();
lean_mark_persistent(l_Lean_Meta_AC_preContext___closed__10);
l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1___closed__1 = _init_l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1___closed__1();
lean_mark_persistent(l_Std_HashSet_toArray___at_Lean_Meta_AC_toACExpr___spec__1___closed__1);
l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__1 = _init_l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__1();
lean_mark_persistent(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__1);
l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__2 = _init_l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__2();
lean_mark_persistent(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__2);
l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__3 = _init_l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__3();
lean_mark_persistent(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__3);
l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__4 = _init_l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__4();
lean_mark_persistent(l_Std_HashMap_find_x21___at_Lean_Meta_AC_toACExpr___spec__13___closed__4);
l_Lean_Meta_AC_toACExpr___closed__1 = _init_l_Lean_Meta_AC_toACExpr___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_toACExpr___closed__1);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__1 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__1();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__1);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__2 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__2();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__2);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__3 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__3();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__3);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__4 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__4();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__4);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__5 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__5();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__5);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__6 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__6();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__6);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__7 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__7();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__7);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__8 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__8();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__8);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__9 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__9();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__9);
l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__10 = _init_l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__10();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Meta_AC_buildNormProof_mkContext___spec__1___closed__10);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__1 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__1);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__2 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__2);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__3 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__3();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__3);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__4 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__4();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__4);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__5 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__5();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__5);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__6 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__6();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__6);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__7 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__7();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__7);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__8 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__8();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__8);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__9 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__9();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__9);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__10 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__10();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__10);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__11 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__11();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__11);
l_Lean_Meta_AC_buildNormProof_mkContext___closed__12 = _init_l_Lean_Meta_AC_buildNormProof_mkContext___closed__12();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_mkContext___closed__12);
l_Lean_Meta_AC_buildNormProof_convert___closed__1 = _init_l_Lean_Meta_AC_buildNormProof_convert___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_convert___closed__1);
l_Lean_Meta_AC_buildNormProof_convert___closed__2 = _init_l_Lean_Meta_AC_buildNormProof_convert___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_convert___closed__2);
l_Lean_Meta_AC_buildNormProof_convert___closed__3 = _init_l_Lean_Meta_AC_buildNormProof_convert___closed__3();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_convert___closed__3);
l_Lean_Meta_AC_buildNormProof_convert___closed__4 = _init_l_Lean_Meta_AC_buildNormProof_convert___closed__4();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_convert___closed__4);
l_Lean_Meta_AC_buildNormProof_convert___closed__5 = _init_l_Lean_Meta_AC_buildNormProof_convert___closed__5();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_convert___closed__5);
l_Lean_Meta_AC_buildNormProof_convert___closed__6 = _init_l_Lean_Meta_AC_buildNormProof_convert___closed__6();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_convert___closed__6);
l_Lean_Meta_AC_buildNormProof_convert___closed__7 = _init_l_Lean_Meta_AC_buildNormProof_convert___closed__7();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_convert___closed__7);
l_Lean_Meta_AC_buildNormProof_convert___closed__8 = _init_l_Lean_Meta_AC_buildNormProof_convert___closed__8();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof_convert___closed__8);
l_Lean_Meta_AC_buildNormProof___closed__1 = _init_l_Lean_Meta_AC_buildNormProof___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof___closed__1);
l_Lean_Meta_AC_buildNormProof___closed__2 = _init_l_Lean_Meta_AC_buildNormProof___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof___closed__2);
l_Lean_Meta_AC_buildNormProof___closed__3 = _init_l_Lean_Meta_AC_buildNormProof___closed__3();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof___closed__3);
l_Lean_Meta_AC_buildNormProof___closed__4 = _init_l_Lean_Meta_AC_buildNormProof___closed__4();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof___closed__4);
l_Lean_Meta_AC_buildNormProof___closed__5 = _init_l_Lean_Meta_AC_buildNormProof___closed__5();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof___closed__5);
l_Lean_Meta_AC_buildNormProof___closed__6 = _init_l_Lean_Meta_AC_buildNormProof___closed__6();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof___closed__6);
l_Lean_Meta_AC_buildNormProof___closed__7 = _init_l_Lean_Meta_AC_buildNormProof___closed__7();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof___closed__7);
l_Lean_Meta_AC_buildNormProof___closed__8 = _init_l_Lean_Meta_AC_buildNormProof___closed__8();
lean_mark_persistent(l_Lean_Meta_AC_buildNormProof___closed__8);
l_Lean_Meta_AC_rewriteUnnormalized___closed__1 = _init_l_Lean_Meta_AC_rewriteUnnormalized___closed__1();
lean_mark_persistent(l_Lean_Meta_AC_rewriteUnnormalized___closed__1);
l_Lean_Meta_AC_rewriteUnnormalized___closed__2 = _init_l_Lean_Meta_AC_rewriteUnnormalized___closed__2();
lean_mark_persistent(l_Lean_Meta_AC_rewriteUnnormalized___closed__2);
l_Lean_Meta_AC_rewriteUnnormalized___closed__3 = _init_l_Lean_Meta_AC_rewriteUnnormalized___closed__3();
lean_mark_persistent(l_Lean_Meta_AC_rewriteUnnormalized___closed__3);
l_Lean_Meta_AC_rewriteUnnormalized___closed__4 = _init_l_Lean_Meta_AC_rewriteUnnormalized___closed__4();
lean_mark_persistent(l_Lean_Meta_AC_rewriteUnnormalized___closed__4);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__1 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__1();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__1);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__2 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__2();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__2);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__3 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__3();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__3);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__4 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__4();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__4);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__5 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__5();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__5);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__6 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__6();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__6);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__7 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__7();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__7);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__8 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__8();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__8);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__9 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__9();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__9);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__10 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__10();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__10);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__11 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__11();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__11);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__12 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__12();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic___closed__12);
res = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__1 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__1();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__1);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__2 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__2();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__2);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__3 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__3();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__3);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__4 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__4();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__4);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__5 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__5();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__5);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__6 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__6();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__6);
l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__7 = _init_l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__7();
lean_mark_persistent(l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange___closed__7);
res = l___regBuiltin_Lean_Meta_AC_ac__refl__tactic_declRange(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = l_Lean_Meta_AC_initFn____x40_Lean_Meta_Tactic_AC_Main___hyg_2111_(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
return lean_io_result_mk_ok(lean_box(0));
}
#ifdef __cplusplus
}
#endif
|
pi-plan/pidal | main.py | <gh_stars>1-10
from pidal.main import main
main()
|
Botanicbot/Controlador | lib/util/Arduino.js | <gh_stars>1-10
var method = Arduino.prototype;
var cmd_restart = "QRPX";
var cmd_network_reset = "QNRX";
var cmd_status = "QSTX";
var Dispositivos = {
Sensor : "S",
Relay : "R",
Motor : "M",
Board : "B"
};
var Operaciones = {
Sensor : {
Temperatura : "T",
Humedad : "H",
PH : "P",
EC : "E",
Lluvia : "L",
HumedadTierra : "S"
},
Relay : {
Encender : "E",
Apagar : "A",
Consultar: "C"
},
Motor : {
Avanzar : "A",
Retroceder : "R",
Detener : "D",
Estado : "E",
Posicion : "P"
}
};
var EstadosMotor = {
"D" : 0,
"A" : 1,
"R" : 2
};
//TODO: Incorporar al modelo
var TipoActuador = {
Sensor : 1,
Relay : 2,
Motor : 3,
Bomba : 4
};
function Arduino()
{
}
method.Dispositivos = function(filter) {
return Dispositivos[filter];
};
method.Operaciones = function(dispositivo) {
return Operaciones[dispositivo];
};
method.EstadosMotor = function() {
return EstadosMotor;
};
method.TipoActuador = function() {
return TipoActuador;
};
method.cmd_restart = function() {
return cmd_restart;
};
method.cmd_network_reset = function() {
return cmd_network_reset;
};
method.cmd_status = function() {
return cmd_status;
};
method.cmd_escape = function() {
return "N";
};
/*
method.Operaciones = function(tipo) {
var ret = null;
switch (tipo) {
case 1:
ret = Operaciones.Sensor;
break;
case 2:
ret = Operaciones.Relay;
break;
case 3:
ret = Operaciones.Motor;
break;
}
return ret;
};
method.Dispositivos = function(tipo) {
var ret = null;
switch (tipo) {
case 1:
ret = Dispositivos.Sensor;
break;
case 2:
ret = Dispositivos.Relay;
break;
case 3:
ret = Dispositivos.Motor;
break;
}
return ret;
};
*/
module.exports = Arduino; |
enfoTek/tomato.linksys.e2000.nvram-mod | tools-src/gnu/gcc/libjava/java/awt/geom/RectangularShape.java | /* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.awt.geom;
import java.awt.*;
import java.awt.geom.Rectangle2D;
/**
* @author <NAME> <<EMAIL>>
* @date April 16, 2000
*/
public abstract class RectangularShape implements Shape, Cloneable
{
protected RectangularShape ()
{
}
public abstract double getX ();
public abstract double getY ();
public abstract double getWidth ();
public abstract double getHeight ();
public double getMinX ()
{
return Math.min (getX (), getX () + getWidth ());
}
public double getMinY ()
{
return Math.min (getY (), getY () + getHeight ());
}
public double getMaxX ()
{
return Math.max (getX (), getX () + getWidth ());
}
public double getMaxY ()
{
return Math.max (getY (), getY () + getHeight ());
}
public double getCenterX ()
{
return getX () + getWidth () / 2;
}
public double getCenterY ()
{
return getY () + getHeight () / 2;
}
public Rectangle2D getFrame ()
{
return new Rectangle2D.Double (getX (), getY (),
getWidth (), getHeight ());
}
public abstract boolean isEmpty ();
public abstract void setFrame (double x, double y, double w, double h);
public void setFrame (Point2D loc, Dimension2D size)
{
setFrame (loc.getX (), loc.getY (), size.getWidth (), size.getHeight ());
}
public void setFrame (Rectangle2D r)
{
setFrame (r.getX (), r.getY (), r.getWidth (), r.getHeight ());
}
public void setFrameFromDiagonal (double x1, double y1,
double x2, double y2)
{
if (x1 > x2)
{
double t = x2;
x2 = x1;
x1 = t;
}
if (y1 > y2)
{
double t = y2;
y2 = y1;
y1 = t;
}
setFrame (x1, y1, x2 - x1, y2 - y1);
}
public void setFrameFromDiagonal (Point2D p1, Point2D p2)
{
setFrameFromDiagonal (p1.getX (), p1.getY (),
p2.getX (), p2.getY ());
}
public void setFrameFromCenter (double centerX, double centerY,
double cornerX, double cornerY)
{
double halfw = Math.abs (cornerX - centerX);
double halfh = Math.abs (cornerY - centerY);
setFrame (centerX - halfw, centerY - halfh,
2 * halfw, 2 * halfh);
}
public void setFrameFromCenter (Point2D center, Point2D corner)
{
setFrameFromCenter (center.getX (), center.getY (),
corner.getX (), corner.getY ());
}
public boolean contains (Point2D p)
{
double x = p.getX ();
double y = p.getY ();
double rx = getX ();
double ry = getY ();
double w = getWidth ();
double h = getHeight ();
return x >= rx && x < rx + w && y >= ry && y < ry + h;
}
public boolean intersects (Rectangle2D r)
{
double x = getX ();
double w = getWidth ();
double mx = r.getX ();
double mw = r.getWidth ();
if (x < mx || x >= mx + mw || x + w < mx || x + w >= mx + mw)
return false;
double y = getY ();
double h = getHeight ();
double my = r.getY ();
double mh = r.getHeight ();
return y >= my && y < my + mh && y + h >= my && y + h < my + mh;
}
private boolean containsPoint (double x, double y)
{
double mx = getX ();
double mw = getWidth ();
if (x < mx || x >= mx + mw)
return false;
double my = getY ();
double mh = getHeight ();
return y >= my && y < my + mh;
}
public boolean contains (Rectangle2D r)
{
return (containsPoint (r.getMinX (), r.getMinY ())
&& containsPoint (r.getMaxX (), r.getMaxY ()));
}
public Rectangle getBounds ()
{
return new Rectangle ((int) getX (), (int) getY (),
(int) getWidth (), (int) getHeight ());
}
public PathIterator getPathIterator (AffineTransform at, double flatness)
{
return at.new Iterator (new Iterator ());
}
public Object clone ()
{
try
{
return super.clone ();
}
catch (CloneNotSupportedException _) {return null;}
}
// This implements the PathIterator for all RectangularShape objects
// that don't override getPathIterator.
private class Iterator implements PathIterator
{
// Our current coordinate.
private int coord;
private static final int START = 0;
private static final int END_PLUS_ONE = 5;
public Iterator ()
{
coord = START;
}
public int currentSegment (double[] coords)
{
int r;
switch (coord)
{
case 0:
coords[0] = getX ();
coords[1] = getY ();
r = SEG_MOVETO;
break;
case 1:
coords[0] = getX () + getWidth ();
coords[1] = getY ();
r = SEG_LINETO;
break;
case 2:
coords[0] = getX () + getWidth ();
coords[1] = getY () + getHeight ();
r = SEG_LINETO;
break;
case 3:
coords[0] = getX ();
coords[1] = getY () + getHeight ();
r = SEG_LINETO;
break;
case 4:
r = SEG_CLOSE;
break;
default:
// It isn't clear what to do if the caller calls us after
// isDone returns true.
r = SEG_CLOSE;
break;
}
return r;
}
public int currentSegment (float[] coords)
{
int r;
switch (coord)
{
case 0:
coords[0] = (float) getX ();
coords[1] = (float) getY ();
r = SEG_MOVETO;
break;
case 1:
coords[0] = (float) (getX () + getWidth ());
coords[1] = (float) getY ();
r = SEG_LINETO;
break;
case 2:
coords[0] = (float) (getX () + getWidth ());
coords[1] = (float) (getY () + getHeight ());
r = SEG_LINETO;
break;
case 3:
coords[0] = (float) getX ();
coords[1] = (float) (getY () + getHeight ());
r = SEG_LINETO;
break;
case 4:
default:
// It isn't clear what to do if the caller calls us after
// isDone returns true. We elect to keep returning
// SEG_CLOSE.
r = SEG_CLOSE;
break;
}
return r;
}
public int getWindingRule ()
{
return WIND_NON_ZERO;
}
public boolean isDone ()
{
return coord == END_PLUS_ONE;
}
public void next ()
{
if (coord < END_PLUS_ONE)
++coord;
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.