text:
.test {
  width: 200px;
  height: 200px;
  background: #008080;
}
.test:hover {
  display: inline-block;
  vertical-align: middle;
  animation-delay: 0.3s, 0s;
  backface-visibility: hidden;
  animation-duration: 1.5s, 0.3s;
  -moz-osx-font-smoothing: grayscale;
  box-shadow: 0 0 1px rgba(0,0,0,0);
  animation-fill-mode: fowards, fowards;
  animation-play-state: running, running;
  animation-direction: alternate, normal;
  animation-iteration-count: infinite, 1;
  animation-name: hvr-hang, hvr-hang-sink;
  animation-timing-function: ease-in-out, ease-out;
}
.test:not(:hover) {
  display: inline-block;
  vertical-align: middle;
  backface-visibility: hidden;
  -moz-osx-font-smoothing: grayscale;
  box-shadow: 0 0 1px rgba(0,0,0,0);
}
@keyframes hvr-hang {
  0% {
    transform: translateY(8px);
  }
  50% {
    transform: translateY(4px);
  }
  100% {
    transform: translateY(8px);
  }
}
@keyframes hvr-hang-sink {
  100% {
    transform: translateY(8px);
  }
}
.test {
  width: 200px;
  height: 200px;
  background: #008080;
}
.test:hover {
  display: inline-block;
  vertical-align: middle;
  animation-delay: 0.3s, 0s;
  backface-visibility: hidden;
  animation-duration: 1.5s, 0.3s;
  -moz-osx-font-smoothing: grayscale;
  box-shadow: 0 0 1px rgba(0,0,0,0);
  animation-fill-mode: fowards, fowards;
  animation-play-state: running, running;
  animation-direction: alternate, normal;
  animation-iteration-count: infinite, 1;
  animation-name: hvr-hang, hvr-hang-sink;
  animation-timing-function: ease-in-out, ease-out;
}
.test:not(:hover) {
  display: inline-block;
  vertical-align: middle;
  backface-visibility: hidden;
  -moz-osx-font-smoothing: grayscale;
  box-shadow: 0 0 1px rgba(0,0,0,0);
}
@keyframes hvr-hang {
  0% {
    transform: translateY(8px);
  }
  50% {
    transform: translateY(4px);
  }
  100% {
    transform: translateY(8px);
  }
}
@keyframes hvr-hang-sink {
  100% {
    transform: translateY(8px);
  }
}


text:
from __future__ import unicode_literals

import multiprocessing
import socket
import time
from contextlib import closing

from attrdict import AttrDict
from six.moves.urllib.error import URLError, HTTPError
from six.moves.urllib.request import urlopen

from . import Context

class FlaskApp(Context):
    """
    Run Flask App as background process and return server_url of Flask server
    """

    def __init__(self, app, timeout=None):
        self.app = app
        self.port = None
        self.timeout = timeout or 5

        self._process = None

    def __call__(self, context=None):
        if not context:
            context = {}

        self.start()

        context.update({
            'server_url': self.server_url,
        })
        return AttrDict(context)

    def start(self):
        """ Start application in a separate process. """
        self.port = self.get_free_port()

        worker = lambda app, port: app.run(port=port, use_reloader=False)
        self._process = multiprocessing.Process(
            target=worker,
            args=(self.app, self.port)
        )
        self._process.start()

        # Wait for server to start
        timestep = 0.5
        for i in range(int(self.timeout / timestep)):
            try:
                urlopen(self.server_url)
            except HTTPError:
                " Server is up, but returns 404 for /"
                break
            except URLError:
                " Server is down, we need to wait."
                time.sleep(timestep)
            else:
                " No error, server is up."
                break

    @property
    def server_url(self):
        """ Returns the complete url based on server options. """
        return 'http://localhost:{0}'.format(self.port or 80)

    def teardown(self):
        """ Stop application process. """
        if self._process:
            self._process.terminate()

    def get_free_port(self):
        """ Get free available port for server. """
        with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
            s.bind(('', 0))
            return s.getsockname()[1]

    def __repr__(self):
        return '<Flask app listening at {0}>'.format(self.server_url)

redpajama_set_name: RedPajamaGithub


text:
package com.zlab.btcmonitorfree.UI;

import android.content.Context;
import android.graphics.Typeface;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.zlab.btcmonitorfree.bm_Main;

import java.util.List;

public class navDrawerCustomView extends ArrayAdapter<String> {
    private final Context context;
    private List<String> values;
    //private List<String> items = new ArrayList<String>(Arrays.asList(values_old));

    public navDrawerCustomView(Context context, List<String> values) {
        super(context, android.R.layout.simple_list_item_activated_1, values);
        this.context = context;
        this.values = values;
        //this.items = new ArrayList<String>(Arrays.asList(values_old));
    }

    public void updateNavDrawer(List<String> newvalues){
        values = newvalues;
        //items = new ArrayList<String>(Arrays.asList(values_old));
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View rowView = inflater.inflate(android.R.layout.simple_list_item_activated_1, parent, false);
        TextView textView = (TextView) rowView.findViewById(android.R.id.text1);
        //ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);

        // Customization to your textView here
        if(position<values.size()){
            textView.setText(values.get(position));}
        if(bm_Main.currentApiVersion >= Build.VERSION_CODES.JELLY_BEAN){
            textView.setTypeface(Typeface.create("sans-serif-condensed", Typeface.BOLD));
        }

        //textView.setTextSize(20);

        return rowView;
    }
}


text:
object Test extends App {
  JavaTest.main(null)

  var a1 : SomeClass = new SomeClass
  var a2 : SomeClass2 = new SomeClass2
  //import language.implicitConversions
  //implicit def setParentType2SomeClass(x:Any) = x.asInstanceOf[SomeClass]
  //implicit def setParentType2SomeClass2(x:Any) = x.asInstanceOf[SomeClass2]
  //var b : SomeClass = a.f.set(23).asInstanceOf[SomeClass].f.set(23).asInstanceOf[SomeClass]
  //var b2 : SomeClass2 = a2.f.set(23).asInstanceOf[SomeClass2].f.set(23).asInstanceOf[SomeClass2]
  var b1 : SomeClass =  a1.f.set(23).f.set(23)
  var b2 : SomeClass2 = a2.f.set(23).f.set(23)
}


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace NMF.Optimizations.Tests
{
    [TestClass]
    public class RepeatAverageTests
    {
        private MockedBenchmark inner;

        [TestInitialize]
        public void LoadInnerBenchmark()
        {
            inner = new MockedBenchmark(
                time: n => 10.0 * n + 10,
                memory: n => 20.0 * n + 30);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void Repeat_Null_Average()
        {
            var repeated = new RepeatAverageBenchmark<string>(null);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void Repeat_0_Average()
        {
            var repeated = new RepeatAverageBenchmark<string>(inner, 0);
        }

        [TestMethod]
        public void Repeat_1_Average()
        {
            var repeated = new RepeatAverageBenchmark<string>(inner, 1);

            var result = repeated.MeasureConfiguration("Foo");
            Assert.AreEqual(10.0, result["Time"]);
            Assert.AreEqual(30.0, result["Memory"]);
        }

        [TestMethod]
        public void Repeat_10_Average()
        {
            var repeated = new RepeatAverageBenchmark<string>(inner, 10);

            var result = repeated.MeasureConfiguration("Bar");
            Assert.AreEqual(55.0, result["Time"]);
            Assert.AreEqual(120.0, result["Memory"]);
        }
    }
}


text:
package com.google.android.exoplayer2.ui;

import android.graphics.Typeface;
import android.text.Html;
import android.text.Spanned;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.BackgroundColorSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
import android.text.style.TypefaceSpan;
import android.text.style.UnderlineSpan;
import android.util.SparseArray;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.text.span.HorizontalTextInVerticalContextSpan;
import com.google.android.exoplayer2.text.span.RubySpan;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.Util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Pattern;

/**
 * Utility class to convert from span-styled text to HTML.
 *
 *
Supports all of the spans used by ExoPlayer's subtitle decoders, including custom ones found
 * in {@link com.google.android.exoplayer2.text.span}.
 */
// TODO: Add support for more span types - only a small selection are currently implemented.
/* package */ final class SpannedToHtmlConverter {

  // Matches /n and /r/n in ampersand-encoding (returned from Html.escapeHtml).
  private static final Pattern NEWLINE_PATTERN = Pattern.compile("(
)?
");

  private SpannedToHtmlConverter() {}

  /**
   * Convert {@code text} into HTML, adding tags and styling to match any styling spans present.
   *
   *
All textual content is HTML-escaped during the conversion.
   *
   *
NOTE: The current implementation does not handle overlapping spans correctly, it will
   * generate overlapping HTML tags that are invalid. In most cases this won't be a problem because:
   *
   *

   *
Most subtitle formats use a tagged structure to carry formatting information (e.g. WebVTT
   *       and TTML), so the {@link Spanned} objects created by these decoders likely won't have
   *       overlapping spans.
   *
WebView/Chromium (the intended destination of this HTML) gracefully handles overlapping
   *       tags and usually renders the same result as spanned text in a TextView.
   *

   *
   * @param text The (possibly span-styled) text to convert to HTML.
   * @param displayDensity The screen density of the device. WebView treats 1 CSS px as one Android
   *     dp, so to convert size values from Android px to CSS px we need to know the screen density.
   */
  public static String convert(@Nullable CharSequence text, float displayDensity) {
    if (text == null) {
      return "";
    }
    if (!(text instanceof Spanned)) {
      return escapeHtml(text);
    }
    Spanned spanned = (Spanned) text;
    SparseArray<Transition> spanTransitions = findSpanTransitions(spanned, displayDensity);

    StringBuilder html = new StringBuilder(spanned.length());
    int previousTransition = 0;
    for (int i = 0; i < spanTransitions.size(); i++) {
      int index = spanTransitions.keyAt(i);
      html.append(escapeHtml(spanned.subSequence(previousTransition, index)));

      Transition transition = spanTransitions.get(index);
      Collections.sort(transition.spansRemoved, SpanInfo.FOR_CLOSING_TAGS);
      for (SpanInfo spanInfo : transition.spansRemoved) {
        html.append(spanInfo.closingTag);
      }
      Collections.sort(transition.spansAdded, SpanInfo.FOR_OPENING_TAGS);
      for (SpanInfo spanInfo : transition.spansAdded) {
        html.append(spanInfo.openingTag);
      }
      previousTransition = index;
    }

    html.append(escapeHtml(spanned.subSequence(previousTransition, spanned.length())));

    return html.toString();
  }

  private static SparseArray<Transition> findSpanTransitions(
      Spanned spanned, float displayDensity) {
    SparseArray<Transition> spanTransitions = new SparseArray<>();

    for (Object span : spanned.getSpans(0, spanned.length(), Object.class)) {
      @Nullable String openingTag = getOpeningTag(span, displayDensity);
      @Nullable String closingTag = getClosingTag(span);
      int spanStart = spanned.getSpanStart(span);
      int spanEnd = spanned.getSpanEnd(span);
      if (openingTag != null) {
        Assertions.checkNotNull(closingTag);
        SpanInfo spanInfo = new SpanInfo(spanStart, spanEnd, openingTag, closingTag);
        getOrCreate(spanTransitions, spanStart).spansAdded.add(spanInfo);
        getOrCreate(spanTransitions, spanEnd).spansRemoved.add(spanInfo);
      }
    }

    return spanTransitions;
  }

  @Nullable
  private static String getOpeningTag(Object span, float displayDensity) {
    if (span instanceof StrikethroughSpan) {
      return "";
    } else if (span instanceof ForegroundColorSpan) {
      ForegroundColorSpan colorSpan = (ForegroundColorSpan) span;
      return Util.formatInvariant(
          "", HtmlUtils.toCssRgba(colorSpan.getForegroundColor()));
    } else if (span instanceof BackgroundColorSpan) {
      BackgroundColorSpan colorSpan = (BackgroundColorSpan) span;
      return Util.formatInvariant(
          "",
          HtmlUtils.toCssRgba(colorSpan.getBackgroundColor()));
    } else if (span instanceof HorizontalTextInVerticalContextSpan) {
      return "";
    } else if (span instanceof AbsoluteSizeSpan) {
      AbsoluteSizeSpan absoluteSizeSpan = (AbsoluteSizeSpan) span;
      float sizeCssPx =
          absoluteSizeSpan.getDip()
              ? absoluteSizeSpan.getSize()
              : absoluteSizeSpan.getSize() / displayDensity;
      return Util.formatInvariant("", sizeCssPx);
    } else if (span instanceof RelativeSizeSpan) {
      return Util.formatInvariant(
          "", ((RelativeSizeSpan) span).getSizeChange() * 100);
    } else if (span instanceof TypefaceSpan) {
      @Nullable String fontFamily = ((TypefaceSpan) span).getFamily();
      return fontFamily != null
          ? Util.formatInvariant("", fontFamily)
          : null;
    } else if (span instanceof StyleSpan) {
      switch (((StyleSpan) span).getStyle()) {
        case Typeface.BOLD:
          return "";
        case Typeface.ITALIC:
          return "";
        case Typeface.BOLD_ITALIC:
          return "";
        default:
          return null;
      }
    } else if (span instanceof RubySpan) {
      RubySpan rubySpan = (RubySpan) span;
      switch (rubySpan.position) {
        case RubySpan.POSITION_OVER:
          return "<ruby style='ruby-position:over;'>";
        case RubySpan.POSITION_UNDER:
          return "<ruby style='ruby-position:under;'>";
        case RubySpan.POSITION_UNKNOWN:
          return "<ruby style='ruby-position:unset;'>";
        default:
          return null;
      }
    } else if (span instanceof UnderlineSpan) {
      return "";
    } else {
      return null;
    }
  }

  @Nullable
  private static String getClosingTag(Object span) {
    if (span instanceof StrikethroughSpan
        || span instanceof ForegroundColorSpan
        || span instanceof BackgroundColorSpan
        || span instanceof HorizontalTextInVerticalContextSpan
        || span instanceof AbsoluteSizeSpan
        || span instanceof RelativeSizeSpan) {
      return "";
    } else if (span instanceof TypefaceSpan) {
      @Nullable String fontFamily = ((TypefaceSpan) span).getFamily();
      return fontFamily != null ? "" : null;
    } else if (span instanceof StyleSpan) {
      switch (((StyleSpan) span).getStyle()) {
        case Typeface.BOLD:
          return "";
        case Typeface.ITALIC:
          return "";
        case Typeface.BOLD_ITALIC:
          return "";
      }
    } else if (span instanceof RubySpan) {
      RubySpan rubySpan = (RubySpan) span;
      return "<rt>" + escapeHtml(rubySpan.rubyText) + "</rt></ruby>";
    } else if (span instanceof UnderlineSpan) {
      return "";
    }
    return null;
  }

  private static Transition getOrCreate(SparseArray<Transition> transitions, int key) {
    @Nullable Transition transition = transitions.get(key);
    if (transition == null) {
      transition = new Transition();
      transitions.put(key, transition);
    }
    return transition;
  }

  private static String escapeHtml(CharSequence text) {
    String escaped = Html.escapeHtml(text);
    return NEWLINE_PATTERN.matcher(escaped).replaceAll("
");
  }

  private static final class SpanInfo {
    /**
     * Sort by end index (descending), then by opening tag and then closing tag (both ascending, for
     * determinism).
     */
    private static final Comparator<SpanInfo> FOR_OPENING_TAGS =
        (info1, info2) -> {
          int result = Integer.compare(info2.end, info1.end);
          if (result != 0) {
            return result;
          }
          result = info1.openingTag.compareTo(info2.openingTag);
          if (result != 0) {
            return result;
          }
          return info1.closingTag.compareTo(info2.closingTag);
        };

    /**
     * Sort by start index (descending), then by opening tag and then closing tag (both descending,
     * for determinism).
     */
    private static final Comparator<SpanInfo> FOR_CLOSING_TAGS =
        (info1, info2) -> {
          int result = Integer.compare(info2.start, info1.start);
          if (result != 0) {
            return result;
          }
          result = info2.openingTag.compareTo(info1.openingTag);
          if (result != 0) {
            return result;
          }
          return info2.closingTag.compareTo(info1.closingTag);
        };

    public final int start;
    public final int end;
    public final String openingTag;
    public final String closingTag;

    private SpanInfo(int start, int end, String openingTag, String closingTag) {
      this.start = start;
      this.end = end;
      this.openingTag = openingTag;
      this.closingTag = closingTag;
    }
  }

  private static final class Transition {
    private final List<SpanInfo> spansAdded;
    private final List<SpanInfo> spansRemoved;

    public Transition() {
      this.spansAdded = new ArrayList<>();
      this.spansRemoved = new ArrayList<>();
    }
  }
}


text:
package org.apache.ambari.server.controller;

import org.apache.ambari.server.actionmanager.HostRoleCommand;

public class ShortTaskStatus {
  protected long taskId;
  protected long stageId;
  protected String hostName;
  protected String role;
  protected String command;
  protected String status;

  public ShortTaskStatus() {
  }

  public ShortTaskStatus(int taskId, long stageId, String hostName, String role, String command, String status) {
    this.taskId = taskId;
    this.stageId = stageId;
    this.hostName = hostName;
    this.role = role;
    this.command = command;
    this.status = status;
  }

  public ShortTaskStatus(HostRoleCommand hostRoleCommand) {
    this.taskId = hostRoleCommand.getTaskId();
    this.stageId = hostRoleCommand.getStageId();
    this.command = hostRoleCommand.getRoleCommand().toString();
    this.hostName = hostRoleCommand.getHostName();
    this.role = hostRoleCommand.getRole().toString();
    this.status = hostRoleCommand.getStatus().toString();
  }

  public long getTaskId() {
    return taskId;
  }

  public void setTaskId(long taskId) {
    this.taskId = taskId;
  }

  public long getStageId() {
    return stageId;
  }

  public void setStageId(long stageId) {
    this.stageId = stageId;
  }

  public String getHostName() {
    return hostName;
  }

  public void setHostName(String hostName) {
    this.hostName = hostName;
  }

  public String getRole() {
    return role;
  }

  public void setRole(String role) {
    this.role = role;
  }

  public String getCommand() {
    return command;
  }

  public void setCommand(String command) {
    this.command = command;
  }

  public String getStatus() {
    return status;
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("ShortTaskStatusDump "
        + ", stageId=" + stageId
        + ", taskId=" + taskId
        + ", hostname=" + hostName
        + ", role=" + role
        + ", command=" + command
        + ", status=" + status);
    return sb.toString();
  }

}


text:
using System;

namespace ZKWebStandard.Testing
{
#pragma warning disable S3925 // "ISerializable" should be implemented correctly
    ///
    /// Assert failed exception

    /// 断言失败的例外

    ///
    /// <seealso cref="Assert"/>
    public class AssertException : Exception
    {
#pragma warning restore S3925 // "ISerializable" should be implemented correctly
        ///
        /// Initialize

        /// 初始化

        ///
        /// <param name="reason">The reason</param>
        public AssertException(string reason) : base(reason) { }
    }
}


text:
<?php declare(strict_types=1);

namespace Limoncello\Tests\Validation;

use DateTime;
use DateTimeImmutable;
use Exception;
use Limoncello\Validation\Blocks\AndBlock;
use Limoncello\Validation\Blocks\IfBlock;
use Limoncello\Validation\Blocks\OrBlock;
use Limoncello\Validation\Blocks\ProcedureBlock;
use Limoncello\Validation\Contracts\Errors\ErrorCodes;
use Limoncello\Validation\Contracts\Execution\ContextInterface;
use Limoncello\Validation\I18n\Messages;
use Limoncello\Validation\Rules\BaseRule;
use Limoncello\Validation\Rules\Comparisons\DateTimeBetween;
use Limoncello\Validation\Rules\Comparisons\DateTimeEquals;
use Limoncello\Validation\Rules\Converters\StringToBool;
use Limoncello\Validation\Rules\Converters\StringToDateTime;
use Limoncello\Validation\Rules\Converters\StringToFloat;
use Limoncello\Validation\Rules\Converters\StringToInt;
use Limoncello\Validation\Rules\Generic\AndOperator;
use Limoncello\Validation\Rules\Generic\Fail;
use Limoncello\Validation\Rules\Generic\IfOperator;
use Limoncello\Validation\Rules\Generic\OrOperator;
use Limoncello\Validation\Rules\Generic\Required;
use Limoncello\Validation\Rules\Generic\Success;
use Limoncello\Validation\Rules\Types\IsArray;
use Limoncello\Validation\Rules\Types\IsBool;
use Limoncello\Validation\Rules\Types\IsDateTime;
use Limoncello\Validation\Rules\Types\IsFloat;
use Limoncello\Validation\Rules\Types\IsInt;
use Limoncello\Validation\Rules\Types\IsNumeric;
use Limoncello\Validation\Rules\Types\IsString;
use PHPUnit\Framework\TestCase;
use function assert;
use function is_callable;

/**
 * @package Limoncello\Tests\Validation
 */
class RulesToBlocksTest extends TestCase
{
    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testOneValueComparision(): void
    {
        $date = new DateTimeImmutable('2001-03-03 04:05:06');
        $rule = new DateTimeEquals($date);

        /** @var IfBlock $block */
        $this->assertTrue(($block = $rule->toBlock()) instanceof IfBlock);
        $this->assertTrue(is_callable($block->getConditionCallable()));
        $this->assertEquals([
            DateTimeEquals::PROPERTY_NAME               => '',
            DateTimeEquals::PROPERTY_IS_CAPTURE_ENABLED => false,
            DateTimeEquals::PROPERTY_VALUE              => $date->getTimestamp(),
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof IfBlock);
        $this->assertEquals([
            DateTimeEquals::PROPERTY_NAME               => 'name',
            DateTimeEquals::PROPERTY_IS_CAPTURE_ENABLED => true,
            DateTimeEquals::PROPERTY_VALUE              => $date->getTimestamp(),
        ], $block->getProperties());

        $this->assertTrue($block->getOnTrue() instanceof ProcedureBlock);
        $this->assertEquals([
            Success::PROPERTY_NAME               => 'name',
            Success::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getOnTrue()->getProperties());

        $this->assertTrue($block->getOnFalse() instanceof ProcedureBlock);
        $this->assertEquals([
            Fail::PROPERTY_NAME                     => 'name',
            Fail::PROPERTY_IS_CAPTURE_ENABLED       => false,
            Fail::PROPERTY_ERROR_CODE               => ErrorCodes::DATE_TIME_EQUALS,
            Fail::PROPERTY_ERROR_MESSAGE_TEMPLATE   => Messages::DATE_TIME_EQUALS,
            Fail::PROPERTY_ERROR_MESSAGE_PARAMETERS => [$date->getTimestamp()],
        ], $block->getOnFalse()->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testTwoValueComparision(): void
    {
        $date1 = new DateTimeImmutable('2001-03-03 04:05:06');
        $date2 = new DateTime('2007-08-09 10:11:12');
        $rule  = new DateTimeBetween($date1, $date2);

        /** @var IfBlock $block */
        $this->assertTrue(($block = $rule->toBlock()) instanceof IfBlock);
        $this->assertTrue(is_callable($block->getConditionCallable()));
        $this->assertEquals([
            DateTimeBetween::PROPERTY_NAME               => '',
            DateTimeBetween::PROPERTY_IS_CAPTURE_ENABLED => false,
            DateTimeBetween::PROPERTY_LOWER_VALUE        => $date1->getTimestamp(),
            DateTimeBetween::PROPERTY_UPPER_VALUE        => $date2->getTimestamp(),
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof IfBlock);
        $this->assertEquals([
            DateTimeBetween::PROPERTY_NAME               => 'name',
            DateTimeBetween::PROPERTY_IS_CAPTURE_ENABLED => true,
            DateTimeBetween::PROPERTY_LOWER_VALUE        => $date1->getTimestamp(),
            DateTimeBetween::PROPERTY_UPPER_VALUE        => $date2->getTimestamp(),
        ], $block->getProperties());

        $this->assertTrue($block->getOnTrue() instanceof ProcedureBlock);
        $this->assertEquals([
            Success::PROPERTY_NAME               => 'name',
            Success::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getOnTrue()->getProperties());

        $this->assertTrue($block->getOnFalse() instanceof ProcedureBlock);
        $this->assertEquals([
            Fail::PROPERTY_NAME                     => 'name',
            Fail::PROPERTY_IS_CAPTURE_ENABLED       => false,
            Fail::PROPERTY_ERROR_CODE               => ErrorCodes::DATE_TIME_BETWEEN,
            Fail::PROPERTY_ERROR_MESSAGE_TEMPLATE   => Messages::DATE_TIME_BETWEEN,
            Fail::PROPERTY_ERROR_MESSAGE_PARAMETERS => [$date1->getTimestamp(), $date2->getTimestamp()],
        ], $block->getOnFalse()->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testStringToBoolConverter(): void
    {
        $rule = new StringToBool();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            StringToBool::PROPERTY_NAME               => '',
            StringToBool::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            StringToBool::PROPERTY_NAME               => 'name',
            StringToBool::PROPERTY_IS_CAPTURE_ENABLED => true,
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testStringToDateTimeConverter(): void
    {
        $rule = new StringToDateTime(DATE_ATOM);

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            StringToDateTime::PROPERTY_NAME               => '',
            StringToDateTime::PROPERTY_IS_CAPTURE_ENABLED => false,
            StringToDateTime::PROPERTY_FORMAT             => DATE_ATOM,
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            StringToDateTime::PROPERTY_NAME               => 'name',
            StringToDateTime::PROPERTY_IS_CAPTURE_ENABLED => true,
            StringToDateTime::PROPERTY_FORMAT             => DATE_ATOM,
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testStringToFloatConverter(): void
    {
        $rule = new StringToFloat();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            StringToFloat::PROPERTY_NAME               => '',
            StringToFloat::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            StringToFloat::PROPERTY_NAME               => 'name',
            StringToFloat::PROPERTY_IS_CAPTURE_ENABLED => true,
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testStringToIntConverter(): void
    {
        $rule = new StringToInt();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            StringToInt::PROPERTY_NAME               => '',
            StringToInt::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            StringToInt::PROPERTY_NAME               => 'name',
            StringToInt::PROPERTY_IS_CAPTURE_ENABLED => true,
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testAndOperator(): void
    {
        $rule = new AndOperator(new Success(), new Fail());

        $this->assertTrue(($block = $rule->toBlock()) instanceof AndBlock);
        $this->assertEquals([
            AndOperator::PROPERTY_NAME               => '',
            AndOperator::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof AndBlock);
        $this->assertEquals([
            AndOperator::PROPERTY_NAME               => 'name',
            AndOperator::PROPERTY_IS_CAPTURE_ENABLED => true,
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testOrOperator(): void
    {
        $rule = new OrOperator(new Success(), new Fail());

        $this->assertTrue(($block = $rule->toBlock()) instanceof OrBlock);
        $this->assertEquals([
            OrOperator::PROPERTY_NAME               => '',
            OrOperator::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof OrBlock);
        $this->assertEquals([
            OrOperator::PROPERTY_NAME               => 'name',
            OrOperator::PROPERTY_IS_CAPTURE_ENABLED => true,
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testIfOperator(): void
    {
        $rule = new IfOperator([static::class, 'dummyConditionCallable'], new Success(), new Fail());

        $this->assertTrue(($block = $rule->toBlock()) instanceof IfBlock);
        $this->assertEquals([
            IfOperator::PROPERTY_NAME               => '',
            IfOperator::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof IfBlock);
        $this->assertEquals([
            IfOperator::PROPERTY_NAME               => 'name',
            IfOperator::PROPERTY_IS_CAPTURE_ENABLED => true,
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testSuccess(): void
    {
        $rule = new Success();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            Success::PROPERTY_NAME               => '',
            Success::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            Success::PROPERTY_NAME               => 'name',
            Success::PROPERTY_IS_CAPTURE_ENABLED => true,
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testFail(): void
    {
        $rule = new Fail();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            Fail::PROPERTY_NAME                     => '',
            Fail::PROPERTY_IS_CAPTURE_ENABLED       => false,
            Fail::PROPERTY_ERROR_CODE               => ErrorCodes::INVALID_VALUE,
            Fail::PROPERTY_ERROR_MESSAGE_TEMPLATE   => Messages::INVALID_VALUE,
            Fail::PROPERTY_ERROR_MESSAGE_PARAMETERS => [],
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
        $this->assertEquals([
            Fail::PROPERTY_NAME                     => 'name',
            Fail::PROPERTY_IS_CAPTURE_ENABLED       => true,
            Fail::PROPERTY_ERROR_CODE               => ErrorCodes::INVALID_VALUE,
            Fail::PROPERTY_ERROR_MESSAGE_TEMPLATE   => Messages::INVALID_VALUE,
            Fail::PROPERTY_ERROR_MESSAGE_PARAMETERS => [],
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testRequired(): void
    {
        $rule = new Required(new Success());

        $this->assertTrue(($block = $rule->toBlock()) instanceof AndBlock);
        $this->assertEquals([
            Required::PROPERTY_NAME               => '',
            Required::PROPERTY_IS_CAPTURE_ENABLED => false,
        ], $block->getProperties());

        $rule->setName('name')->enableCapture();

        $this->assertTrue(($block = $rule->toBlock()) instanceof AndBlock);
        $this->assertEquals([
            Required::PROPERTY_NAME               => 'name',
            Required::PROPERTY_IS_CAPTURE_ENABLED => true,
        ], $block->getProperties());
    }

    /**
     * Test rule to blocks transformation.
     *
     * @throws Exception
     */
    public function testTypes(): void
    {
        $classes = [
            IsArray::class,
            IsBool::class,
            IsDateTime::class,
            IsFloat::class,
            IsInt::class,
            IsNumeric::class,
            IsString::class,
        ];
        foreach ($classes as $className) {
            /** @var BaseRule $rule */
            $rule = new $className();

            $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
            $this->assertEquals([
                IsArray::PROPERTY_NAME               => '',
                IsArray::PROPERTY_IS_CAPTURE_ENABLED => false,
            ], $block->getProperties());

            $rule->setName('name')->enableCapture();

            $this->assertTrue(($block = $rule->toBlock()) instanceof ProcedureBlock);
            $this->assertEquals([
                IsArray::PROPERTY_NAME               => 'name',
                IsArray::PROPERTY_IS_CAPTURE_ENABLED => true,
            ], $block->getProperties());
        }
    }

    /**
     * @param mixed            $input
     * @param ContextInterface $context
     *
     * @return bool
     */
    public static function dummyConditionCallable($input, ContextInterface $context): bool
    {
        assert($input || $context);

        return true;
    }
}


text:
package com.amazonaws.services.cloudfront.model.transform;

import java.util.ArrayList;

import javax.xml.stream.events.XMLEvent;
import javax.annotation.Generated;

import com.amazonaws.services.cloudfront.model.*;
import com.amazonaws.transform.Unmarshaller;

import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;

/**
 * DistributionSummary StAX Unmarshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DistributionSummaryStaxUnmarshaller implements Unmarshaller<DistributionSummary, StaxUnmarshallerContext> {

    public DistributionSummary unmarshall(StaxUnmarshallerContext context) throws Exception {
        DistributionSummary distributionSummary = new DistributionSummary();
        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        if (context.isStartOfDocument())
            targetDepth += 1;

        while (true) {
            XMLEvent xmlEvent = context.nextEvent();
            if (xmlEvent.isEndDocument())
                return distributionSummary;

            if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

                if (context.testExpression("Id", targetDepth)) {
                    distributionSummary.setId(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("ARN", targetDepth)) {
                    distributionSummary.setARN(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("Status", targetDepth)) {
                    distributionSummary.setStatus(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("LastModifiedTime", targetDepth)) {
                    distributionSummary.setLastModifiedTime(DateStaxUnmarshallerFactory.getInstance("iso8601").unmarshall(context));
                    continue;
                }

                if (context.testExpression("DomainName", targetDepth)) {
                    distributionSummary.setDomainName(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("Aliases", targetDepth)) {
                    distributionSummary.setAliases(AliasesStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("Origins", targetDepth)) {
                    distributionSummary.setOrigins(OriginsStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("OriginGroups", targetDepth)) {
                    distributionSummary.setOriginGroups(OriginGroupsStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("DefaultCacheBehavior", targetDepth)) {
                    distributionSummary.setDefaultCacheBehavior(DefaultCacheBehaviorStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("CacheBehaviors", targetDepth)) {
                    distributionSummary.setCacheBehaviors(CacheBehaviorsStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("CustomErrorResponses", targetDepth)) {
                    distributionSummary.setCustomErrorResponses(CustomErrorResponsesStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("Comment", targetDepth)) {
                    distributionSummary.setComment(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("PriceClass", targetDepth)) {
                    distributionSummary.setPriceClass(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("Enabled", targetDepth)) {
                    distributionSummary.setEnabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("ViewerCertificate", targetDepth)) {
                    distributionSummary.setViewerCertificate(ViewerCertificateStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("Restrictions", targetDepth)) {
                    distributionSummary.setRestrictions(RestrictionsStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("WebACLId", targetDepth)) {
                    distributionSummary.setWebACLId(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("HttpVersion", targetDepth)) {
                    distributionSummary.setHttpVersion(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("IsIPV6Enabled", targetDepth)) {
                    distributionSummary.setIsIPV6Enabled(BooleanStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("AliasICPRecordals", targetDepth)) {
                    distributionSummary.withAliasICPRecordals(new ArrayList<AliasICPRecordal>());
                    continue;
                }

                if (context.testExpression("AliasICPRecordals/AliasICPRecordal", targetDepth)) {
                    distributionSummary.withAliasICPRecordals(AliasICPRecordalStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

            } else if (xmlEvent.isEndElement()) {
                if (context.getCurrentDepth() < originalDepth) {
                    return distributionSummary;
                }
            }
        }
    }

    private static DistributionSummaryStaxUnmarshaller instance;

    public static DistributionSummaryStaxUnmarshaller getInstance() {
        if (instance == null)
            instance = new DistributionSummaryStaxUnmarshaller();
        return instance;
    }
}


text:
<?php

require_once __DIR__ . '/../vendor/autoload.php';

HtmlDriven\CorsProxyTests\Helpers\Environment::setup();


text:
/**
 * @file
 * @brief Defines the AABox2d class.
 */

#ifndef MODULES_COMMON_MATH_AABOX2D_H_
#define MODULES_COMMON_MATH_AABOX2D_H_

#include <string>
#include <vector>

#include "modules/common/math/vec2d.h"

/**
 * @namespace apollo::common::math
 * @brief apollo::common::math
 */
namespace apollo {
namespace common {
namespace math {

/**
 * @class AABox2d
 * @brief Implements a class of (undirected) axes-aligned bounding boxes in 2-D.
 * This class is referential-agnostic.
 */
class AABox2d {
 public:
  /**
   * @brief Default constructor.
   * Creates an axes-aligned box with zero length and width at the origin.
   */
  AABox2d() = default;
  /**
   * @brief Parameterized constructor.
   * Creates an axes-aligned box with given center, length, and width.
   * @param center The center of the box
   * @param length The size of the box along the x-axis
   * @param width The size of the box along the y-axis
   */
  AABox2d(const Vec2d &center, const double length, const double width);
  /**
   * @brief Parameterized constructor.
   * Creates an axes-aligned box from two opposite corners.
   * @param one_corner One corner of the box
   * @param opposite_corner The opposite corner to the first one
   */
  AABox2d(const Vec2d &one_corner, const Vec2d &opposite_corner);
  /**
   * @brief Parameterized constructor.
   * Creates an axes-aligned box containing all points in a given vector.
   * @param points Vector of points to be included inside the box.
   */
  explicit AABox2d(const std::vector<Vec2d> &points);

  /**
   * @brief Getter of center_
   * @return Center of the box
   */
  const Vec2d &center() const { return center_; }

  /**
  * @brief Getter of x-component of center_
  * @return x-component of the center of the box
  */
  double center_x() const { return center_.x(); }

  /**
  * @brief Getter of y-component of center_
  * @return y-component of the center of the box
  */
  double center_y() const { return center_.y(); }

  /**
  * @brief Getter of length_
  * @return The length of the box
  */
  double length() const { return length_; }

  /**
  * @brief Getter of width_
  * @return The width of the box
  */
  double width() const { return width_; }

  /**
  * @brief Getter of half_length_
  * @return Half of the length of the box
  */
  double half_length() const { return half_length_; }

  /**
  * @brief Getter of half_width_
  * @return Half of the width of the box
  */
  double half_width() const { return half_width_; }

  /**
  * @brief Getter of length_*width_
  * @return The area of the box
  */
  double area() const { return length_ * width_; }

  /**
  * @brief Returns the minimum x-coordinate of the box
  *
  * @return x-coordinate
  */
  double min_x() const { return center_.x() - half_length_; }

  /**
  * @brief Returns the maximum x-coordinate of the box
  *
  * @return x-coordinate
  */
  double max_x() const { return center_.x() + half_length_; }

  /**
  * @brief Returns the minimum y-coordinate of the box
  *
  * @return y-coordinate
  */
  double min_y() const { return center_.y() - half_width_; }

  /**
  * @brief Returns the maximum y-coordinate of the box
  *
  * @return y-coordinate
  */
  double max_y() const { return center_.y() + half_width_; }

  /**
  * @brief Gets all corners in counter clockwise order.
  *
  * @param corners Output where the corners are written
  */
  void GetAllCorners(std::vector<Vec2d> *const corners) const;

  /**
  * @brief Determines whether a given point is in the box.
  *
  * @param point The point we wish to test for containment in the box
  */
  bool IsPointIn(const Vec2d &point) const;

  /**
  * @brief Determines whether a given point is on the boundary of the box.
  *
  * @param point The point we wish to test for boundary membership
  */
  bool IsPointOnBoundary(const Vec2d &point) const;

  /**
  * @brief Determines the distance between a point and the box.
  *
  * @param point The point whose distance to the box we wish to determine.
  */
  double DistanceTo(const Vec2d &point) const;

  /**
  * @brief Determines the distance between two boxes.
  *
  * @param box Another box.
  */
  double DistanceTo(const AABox2d &box) const;

  /**
  * @brief Determines whether two boxes overlap.
  *
  * @param box Another box
  */
  bool HasOverlap(const AABox2d &box) const;

  /**
  * @brief Shift the center of AABox by the input vector.
  *
  * @param shift_vec The vector by which we wish to shift the box
  */
  void Shift(const Vec2d &shift_vec);

  /**
  * @brief Changes box to include another given box, as well as the current one.
  *
  * @param other_box Another box
  */
  void MergeFrom(const AABox2d &other_box);

  /**
  * @brief Changes box to include a given point, as well as the current box.
  *
  * @param other_point Another point
  */
  void MergeFrom(const Vec2d &other_point);

  /**
  * @brief Gets a human-readable debug string
  *
  * @return A string
  */
  std::string DebugString() const;

 private:
  Vec2d center_;
  double length_ = 0.0;
  double width_ = 0.0;
  double half_length_ = 0.0;
  double half_width_ = 0.0;
};

}  // namespace math
}  // namespace common
}  // namespace apollo

#endif /* MODULES_COMMON_MATH_AABOX2D_H_ */


text:
package org.blockartistry.mod.Restructured.util;

import java.util.Collection;

import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockLog.EnumAxis;
import net.minecraft.block.BlockTrapDoor;
import net.minecraft.block.IGrowable;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.IPlantable;

public class BlockHelper {

	private static final PropertyDirection FACING = PropertyDirection.create("facing");

	private BlockHelper() {
	}

	public static boolean isAir(final IBlockState state) {
		return isAir(state.getBlock());
	}

	public static boolean isAir(final Block block) {
		return block == Blocks.air;
	}

	public static boolean canBreath(final IBlockState state) {
		return canBreath(state.getBlock());
	}

	public static boolean canBreath(final Block block) {
		return isAir(block) || !block.getMaterial().isSolid();
	}

	public static boolean isChest(final IBlockState state) {
		return isChest(state.getBlock());
	}

	public static boolean isChest(final Block block) {
		return block == Blocks.chest || block == Blocks.ender_chest || block == Blocks.trapped_chest;
	}

	public static boolean isAnvil(final IBlockState state) {
		return isAnvil(state.getBlock());
	}

	public static boolean isAnvil(final Block block) {
		return block == Blocks.anvil;
	}

	public static boolean isLadder(final IBlockState state) {
		return isLadder(state.getBlock());
	}

	public static boolean isLadder(final Block block) {
		return block == Blocks.ladder;
	}

	public static boolean isFurnace(final IBlockState state) {
		return isFurnace(state.getBlock());
	}

	public static boolean isFurnace(final Block block) {
		return block == Blocks.furnace || block == Blocks.lit_furnace;
	}

	public static boolean isLava(final IBlockState state) {
		return isLava(state.getBlock());
	}

	public static boolean isLava(final Block block) {
		return block == Blocks.lava || block == Blocks.flowing_lava;
	}

	public static boolean isWater(final IBlockState state) {
		return isWater(state.getBlock());
	}

	public static boolean isWater(final Block block) {
		return block == Blocks.water || block == Blocks.flowing_water;
	}

	public static boolean isFire(final IBlockState state) {
		return isFire(state.getBlock());
	}

	public static boolean isFire(final Block block) {
		return block == Blocks.fire;
	}

	public static boolean isFireSource(final IBlockState state) {
		return isFireSource(state.getBlock());
	}

	public static boolean isFireSource(final Block block) {
		return isFire(block) || isLava(block);
	}

	public static boolean isTorch(final IBlockState state) {
		return isTorch(state.getBlock());
	}

	public static boolean isTorch(final Block block) {
		return block == Blocks.torch || block == Blocks.redstone_torch;
	}

	public static boolean isLever(final IBlockState state) {
		return isLever(state.getBlock());
	}

	public static boolean isLever(final Block block) {
		return block == Blocks.lever;
	}

	public static boolean isButton(final IBlockState state) {
		return isButton(state.getBlock());
	}

	public static boolean isButton(final Block block) {
		return block == Blocks.stone_button || block == Blocks.wooden_button;
	}

	public static boolean isDoor(final IBlockState state) {
		return isDoor(state.getBlock());
	}

	public static boolean isDoor(final Block block) {
		return block instanceof BlockDoor || block instanceof BlockTrapDoor;
	}

	public static boolean isSpawner(final IBlockState state) {
		return isSpawner(state.getBlock());
	}

	public static boolean isSpawner(final Block block) {
		return block == Blocks.mob_spawner;
	}

	public static boolean isMonsterEgg(final IBlockState state) {
		return isMonsterEgg(state.getBlock());
	}

	public static boolean isMonsterEgg(final Block block) {
		return block == Blocks.monster_egg;
	}

	public static boolean isLiquid(final IBlockState state) {
		return isLiquid(state.getBlock());
	}

	public static boolean isLiquid(final Block block) {
		return block.getMaterial().isLiquid();
	}

	public static boolean isSolid(final IBlockState state) {
		return isSolid(state.getBlock());
	}

	public static boolean isSolid(final Block block) {
		return block.getMaterial().isSolid();
	}

	public static boolean isPlantable(final IBlockState state) {
		return isPlantable(state.getBlock());
	}

	public static boolean isPlantable(final Block block) {
		return block instanceof IPlantable;
	}

	public static boolean isGrowable(final IBlockState state) {
		return isGrowable(state.getBlock());
	}

	public static boolean isGrowable(final Block block) {
		return block instanceof IGrowable;
	}

	public static boolean isCrop(final IBlockState state) {
		return isCrop(state.getBlock());
	}

	public static boolean isCrop(final Block block) {
		return block instanceof BlockCrops;
	}

	public static boolean isSlab(final IBlockState state) {
		return isSlab(state.getBlock());
	}

	public static boolean isSlab(final Block block) {
		return block == Blocks.wooden_slab || block == Blocks.stone_slab;
	}

	public static boolean isLog(final IBlockState state) {
		return isLog(state.getBlock());
	}

	public static boolean isLog(final Block block) {
		return block instanceof BlockLog;
	}

	public static boolean isPlank(final IBlockState state) {
		return isPlank(state.getBlock());
	}

	public static boolean isPlank(final Block block) {
		return block == Blocks.planks;
	}

	public static EnumFacing getOrientation(final IBlockState state) {
		if (state.getPropertyNames().contains(FACING))
			return state.getValue(FACING);
		if (state.getPropertyNames().contains(BlockLog.LOG_AXIS)) {
			final EnumAxis axis = state.getValue(BlockLog.LOG_AXIS);
			if (axis == EnumAxis.Y)
				return EnumFacing.UP;
			if (axis == EnumAxis.X)
				return EnumFacing.NORTH;
			if (axis == EnumAxis.Z)
				return EnumFacing.EAST;
		}

		return null;
	}

	public static IBlockState rotate(final IBlockState state, final int count) {

		if (count == 0)
			return state;

		@SuppressWarnings("rawtypes")
		Collection<IProperty> props = state.getPropertyNames();

		if (props.contains(BlockLog.LOG_AXIS)) {
			if (count == 1 || count == 3) {
				final EnumAxis axis = state.getValue(BlockLog.LOG_AXIS);
				if (axis == EnumAxis.Y)
					return state;
				return state.withProperty(BlockLog.LOG_AXIS, axis == EnumAxis.Z ? EnumAxis.X : EnumAxis.Z);
			}
			return state;
		} else if (props.contains(FACING)) {
			EnumFacing current = getOrientation(state);
			if (current == null || current == EnumFacing.UP || current == EnumFacing.DOWN)
				return state;

			for (int i = 0; i < count; i++)
				current = current.rotateY();

			return state.withProperty(FACING, current);
		}

		return state;
	}
}


text:
// load file hander lib
var fs = require('fs');

//facebook lib
var login = require("facebook-chat-api");

// get the constants
var constants = require(__dirname + "/../../constants.js");

/*
* Message Function
*/

function Message(ModuleParams){

    var message = ModuleParams["message"];
    var threadId = ModuleParams["threadId"]
    login({email: constants.FACEBOOK_USERNAME , password: constants.FACEBOOK_PASSWORD}, function callback (err, api) {

        if(err) return console.error(err);

        api.sendMessage(message, threadId);

    });

}

/* Expose Module */
module.exports.Message = Message;


text:
agentlewis.github.io
==================


text:
require_relative 'simple'
require_relative 'fee_mixin'

module Cryptobroker::Broker::Backtesting
  class TransactionFee < Simple
    include Cryptobroker::Broker::Backtesting::FeeMixin

    def initialize(type, price, start_amount, fee)
      super(type, price, start_amount)
      initialize_fee_mixin(fee)
    end

    protected

    def achieve_base_target(price)
      @base += base_equivalent(price) * buy_fee_factor
      @quote = 0.to_d
    end

    def achieve_quote_target(price)
      @quote += quote_equivalent(price) * sell_fee_factor
      @base = 0.to_d
    end
  end
end


text:
package org.apache.abdera.i18n.iri;

import org.apache.abdera.i18n.text.UrlEncoding;
import org.apache.abdera.i18n.text.CharUtils.Profile;

class HttpScheme extends AbstractScheme {

    static final String NAME = "http";
    static final int DEFAULT_PORT = 80;

    public HttpScheme() {
        super(NAME, DEFAULT_PORT);
    }

    protected HttpScheme(String name, int port) {
        super(name, port);
    }

    @Override
    public IRI normalize(IRI iri) {
        StringBuilder buf = new StringBuilder();
        int port = (iri.getPort() == getDefaultPort()) ? -1 : iri.getPort();
        String host = iri.getHost();
        if (host != null)
            host = host.toLowerCase();
        String ui = iri.getUserInfo();
        iri.buildAuthority(buf, ui, host, port);
        String authority = buf.toString();
        return new IRI(iri._scheme, iri.getScheme(), authority, ui, host, port, IRI.normalize(iri.getPath()),
                       UrlEncoding.encode(UrlEncoding.decode(iri.getQuery()), Profile.IQUERY.filter()), UrlEncoding
                           .encode(UrlEncoding.decode(iri.getFragment()), Profile.IFRAGMENT.filter()));
    }

    // use the path normalization coded into the IRI class
    public String normalizePath(String path) {
        return null;
    }

}


text:
Action

 >Suggest an Edit

 Loading...

                  Logo

                        Title

            <legend ng-if="document.description || document.descriptionNative || document.symbol || document.type" class="view">Details</legend>

                    Description

                    Description Naitve Language

                        Symbol

                    Type

{{term | term:locale}}

            <legend ng-if="document.startDate || document.endDate || document.durations" class="view">Durations</legend>

                    Start date and time

{{document.startDate | moment:'format':'YYYY-MM-DD HH:mm'}}

                    End date and time

{{document.endDate | moment:'format':'YYYY-MM-DD HH:mm'}}

                    Durations

{{duration.title | lstring}}

 {{duration.startDate | moment:'format':'YYYY-MM-DD HH:mm'}}
            to
 {{duration.endDate | moment:'format':'YYYY-MM-DD HH:mm'}}

            <legend ng-if="document.address" class="view">Location</legend>

                        Address
                        <address class="km-value">

{{document.address.address | lstring:locale}}

                        {{document.address.city | lstring:locale}},
                        {{document.address.state | lstring:locale}}

                        {{document.address.postalCode | lstring:locale}},
                        {{document.address.country | term:locale}} <image style="height:15px;;" ng-src="https://www.cbd.int/images/flags/96/flag-{{document.country.identifier}}-96.png?v=<%=gitVersion%>"></image>
                      </address>

                          Map

            <legend ng-if="document.websites || document.videos || document.documents || document.images || document.logo " class="view">Social Media</legend>

                        Website

                                     {{item.name||item.url}}

({{item.url}})

                        Facebook

                                     {{item.name||item.url}}

({{item.url}})

                        Twitter

                                     {{item.name||item.url}}

({{item.url}})

                        Youtube

                                     {{item.name||item.url}}

({{item.url}})

                        Additional Links

                                     {{item.name||item.url}}

({{item.url}})

                        Images

                                     {{item.name||item.url}}

({{item.url}})

                        Documents

                                     {{item.name||item.url}}

({{item.url}})

                        Videos

                                     {{item.name||item.url}}

({{item.url}})

            <legend class="view" ng-if="contactOrganization">Contact Host Organization</legend>

                          <img   style="max-width:100%;" ng-src="{{contactOrganization.logo.url}}?v=<%=gitVersion%>">

                            {{contactOrganization.document.name | lstring:locale}} ({{contactOrganization.document.acronym | lstring:locale}})

                          <address>

{{contactOrganization.document.address | lstring:locale}}

                          {{contactOrganization.document.city | lstring:locale}},
                          {{contactOrganization.document.state | lstring:locale}}

                          {{contactOrganization.document.postalCode | lstring:locale}},
                          {{contactOrganization.document.country | term:locale}} <image style="height:15px;;" ng-src="https://www.cbd.int/images/flags/96/flag-{{contactOrganization.document.country.identifier}}-96.png?v=<%=gitVersion%>"></image>

                              :

                                  {{item}}

                              |

                              : {{item}}
                                  |

                              : {{item}}
                                |

                                  {{item.name.toUpperCase()||item.url}}

                              |

                                  {{ lang | term:locale | uppercase}}

                                  {{contactOrganization.document.organizationType | term:locale | uppercase}}

                        </address>

            <legend class="view" ng-if="organizations && organizations.length>1">Contributing Host Organization(s)</legend>

1">

                        <img style="max-width:100%;" ng-src="{{organization.logo.url}}?v=<%=gitVersion%>">

                        {{organization.document.name | lstring:locale}} ({{organization.document.acronym | lstring:locale}})
                        <address>

{{organization.document.address | lstring:locale}}

                            {{organization.document.city | lstring:locale}},
                            {{organization.document.state | lstring:locale}}

                            {{organization.document.postalCode | lstring:locale}},
                            {{organization.document.country | term:locale}} <image style="height:15px;;" ng-src="https://www.cbd.int/images/flags/96/flag-{{organization.document.country.identifier}}-96.png?v=<%=gitVersion%>"></image>

                                :

                                    {{item}}

                                |

                                : {{item}}
                                    |

                                : {{item}}
                                  |

                                    {{item.name.toUpperCase()||item.url}}

                                |

                                    {{ lang | term:locale | uppercase}}

                                    {{organization.document.organizationType | term:locale | uppercase}}

                          </address>

                <legend class="view" ng-if="document.thematicAreas || document.aichiTargets ">Thematic Areas</legend>

                        Related CBD subject area(s)

{{term | term:locale}}

                        Related Aichi Biodiversity Target(s)

                                <img style="height: 20px;  width: 20px; margin-bottom:5px; " ng-src="https://www.cbd.int/images/aichi/48/abt-{{getAichiNumber(term)}}-48.png?v=<%=gitVersion%>">
                                {{term | term:locale}}

            <legend class="view" ng-if="document.relevantInformation || document.relevantDocuments  ||contacts">Additional Information and Documents</legend>

                 Additional information

                    {{document.relevantInformation | lstring}}

                Other relevant website address or attached documents

{{item.name||item.url}}

                Contact person in the organization

                    {{contact.document.firstName|lstring:locale}} {{contact.document.middleName|lstring:locale}} {{contact.document.lastName|lstring:locale}}

Action

 Suggest an Edit


text:
<link rel="import" href="../polymer/polymer.html">

<!--
Web component to control keyboard via Cordova plugin.

### Example
```html
<polymer-cordova-keyboard hide-keyboard-accessory-bar></polymer-cordova-keyboard>
```

-->
<dom-module id="polymer-cordova-keyboard">

	<script>

		class PolymerCordovaKeyboard extends Polymer.Element {

			static get is() {
				return 'polymer-cordova-keyboard';
			}

			static get properties() {
				return {
					/**
					* True if the keyboard accessory bar should be shown
					*/
					hideKeyboardAccessoryBar: {
						type: Boolean,
						notify: false,
						observer: '_changeHideKeyboardAccessoryBar',
					},
				};
			}

			ready() {
				super.ready();

				// Avoid race condition if Polymer is initialized before Cordova
				document.addEventListener(
					"deviceready",
					() => this._setHideKeyboardAccessoryBar(this.hideKeyboardAccessoryBar),
					false);
			}

			/**
			* Shows the keyboard accessory bar
			*/
			show() {
				this.hideKeyboardAccessoryBar = false;
			}

			/**
			* Hides the keyboard accessory bar
			*/
			hide() {
				this.hideKeyboardAccessoryBar = true;
			}

			// Private methods
			_changeHideKeyboardAccessoryBar(newValue, oldValue) {
				this._setHideKeyboardAccessoryBar(newValue);
			}

			_setHideKeyboardAccessoryBar(value) {
				if (typeof cordova == 'undefined' || typeof cordova.plugins == 'undefined' || typeof cordova.plugins.Keyboard == 'undefined') {
					// Ignore if cordova plugin is not available
					return;
				}

				cordova.plugins.Keyboard.hideKeyboardAccessoryBar(value);
			}

		}
		customElements.define(PolymerCordovaKeyboard.is, PolymerCordovaKeyboard);

	</script>

</dom-module>


text:
/**
 *
 */
package com.baosight.iplat4j.ee.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.dao.Dao;
import com.baosight.iplat4j.ee.domain.TEE504;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.iplat4j.util.TeleUtils;

/**
 * @author wangyuqiu
 *
 */
public class ServiceEE504 extends ServiceEPBase {
	public EiInfo initLoad(EiInfo info){
		return query(info);
	}
	public EiInfo query(EiInfo info){
		EiInfo outInfo = new EiInfo();
		TEE504 tee504 = new TEE504();

		StringBuffer buffer = new StringBuffer();
		List list = new ArrayList();
		Map param = new HashMap();
		try {
			outInfo = query(info, "EE504.query", tee504);
//			list = dao.query("EE504.query", param);
		}catch(Exception e){
			buffer.append(e.getMessage());
		}
//		outInfo.addBlock("result").addBlockMeta(tee504.eiMetadata);
//		outInfo.getBlock("result").addRows(list);
//		outInfo.getBlock("result").setRows(list);
		buffer.append("查询成功!");
		outInfo.setMsg(buffer.toString());
		return outInfo;
	}

	public EiInfo getTeleStr(EiInfo info){
		int i = info.getInt("row");
		int j = info.getInt("col");
		TEE504 tee504 = new TEE504();
		EiInfo outInfo = new EiInfo();
		String str = null;
		try {
			outInfo = query(info, "EE504.query", tee504);
		}catch(Exception e){
			e.printStackTrace();
		}
		if(j == 4)//beantoStr
		{
			tee504.fromMap(outInfo.getBlock("result").getRow(i));
			str = TeleUtils.bean2Str(tee504, "",TeleUtils.TELE_DEFAULT_TYPE);
		}else if(j == 5){
			str = TeleUtils.block2Str(outInfo.getBlock("result"));
		}

		outInfo.set("teleStr", str);
		System.out.println(str);
		return outInfo;
	}

	public EiInfo update( EiInfo inInfo )
	{
		StringBuffer buffer = new StringBuffer();
		StringBuffer detail = new StringBuffer();

		Dao tt = this.getDao();
		for ( int i = 0; i < inInfo.getBlock( "result" ).getRowCount(); i++ )
		{
			try
			{
				tt.update( "EE504.update",
						inInfo.getBlock( "result" ).getRow( i ) );
				buffer.append( "更新第" + i + "条记录成功\n" );
			}
			catch( Exception ex )
			{
				buffer.append( "更新第" + i + "条记录失败\n" );
				inInfo.setStatus(-1);
				detail.append( ex.getCause().toString());
			}
		}
		inInfo.setMsg( buffer.toString() );
		inInfo.setDetailMsg( detail.toString() );
		return query( inInfo );
	}

	public EiInfo insert( EiInfo inInfo )
	{
		StringBuffer buffer = new StringBuffer();
		StringBuffer detail = new StringBuffer();
		Dao tt = this.getDao();
		for ( int i = 0; i < inInfo.getBlock( "result" ).getRowCount(); i++ )
		{
			try
			{
				tt.insert( "EE504.insert",
						inInfo.getBlock( "result" ).getRow( i ) );
				buffer.append( "新增第" + i + "条记录成功\n" );
			}
			catch( Exception ex )
			{
				buffer.append( "新增第" + i + "条记录失败\n" );
				inInfo.setStatus(-1);
				detail.append( ex.getCause().toString());
			}
		}
		inInfo.setMsg( buffer.toString() );
		inInfo.setDetailMsg( detail.toString() );
		return query( inInfo );
	}

	public EiInfo delete( EiInfo inInfo )
	{
		StringBuffer buffer = new StringBuffer();
		StringBuffer detail = new StringBuffer();

		Dao tt = this.getDao();
		for ( int i = 0; i < inInfo.getBlock( "result" ).getRowCount(); i++ )
		{
			try
			{
				tt.delete( "EE504.delete",
						( String ) inInfo.getBlock( "result" ).getCell( i, "typeLong" ) );
				buffer.append( "删除第" + i + "条记录成功\n" );
			}
			catch( Exception ex )
			{
				buffer.append( buffer.append( "删除第" + i + "条记录失败\n" ) );
				inInfo.setStatus(-1);
				detail.append( ex.getCause().toString());
			}
		}
		inInfo.setMsg( buffer.toString() );
		inInfo.setDetailMsg( detail.toString() );
		return query( inInfo );
	}

}


text:
A JSON object corresponding to the Activity Instance tree of the given process instance.
## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **String** | The id of the activity instance. |  [optional]
**parentActivityInstanceId** | **String** | The id of the parent activity instance, for example a sub process instance. |  [optional]
**activityId** | **String** | The id of the activity. |  [optional]
**activityName** | **String** | The name of the activity |  [optional]
**activityType** | **String** | The type of activity (corresponds to the XML element name in the BPMN 2.0, e.g., 'userTask') |  [optional]
**processInstanceId** | **String** | The id of the process instance this activity instance is part of. |  [optional]
**processDefinitionId** | **String** | The id of the process definition. |  [optional]
**childActivityInstances** | [**List<ActivityInstanceDto>**](ActivityInstanceDto.md) | A list of child activity instances. |  [optional]
**childTransitionInstances** | [**List<TransitionInstanceDto>**](TransitionInstanceDto.md) | A list of child transition instances. A transition instance represents an execution waiting in an asynchronous continuation. |  [optional]
**executionIds** | **List<String>** | A list of execution ids. |  [optional]
**incidentIds** | **List<String>** | A list of incident ids. |  [optional]
**incidents** | [**List<ActivityInstanceIncidentDto>**](ActivityInstanceIncidentDto.md) | A list of JSON objects containing incident specific properties: * `id`: the id of the incident * `activityId`: the activity id in which the incident occurred |  [optional]


text:
#nullable enable

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Linq;
using DatenMeister.Core.EMOF.Implementation.DotNet;
using DatenMeister.Core.EMOF.Interface.Common;
using DatenMeister.Core.EMOF.Interface.Identifiers;
using DatenMeister.Core.EMOF.Interface.Reflection;
using DatenMeister.Core.Helper;
using DatenMeister.Core.Models;
using DatenMeister.Core.Models.EMOF;
using DatenMeister.Core.Provider;
using DatenMeister.Core.Provider.Xmi;
using DatenMeister.Core.Runtime.ChangeEvents;
using DatenMeister.Core.Runtime.Copier;
using DatenMeister.Core.Runtime.DynamicFunctions;
using DatenMeister.Core.Runtime.Workspaces;

namespace DatenMeister.Core.EMOF.Implementation
{
    /// <summary>
    /// Implements the extent interface according the MOF specification
    /// </summary>
    public class MofExtent : IExtent, IHasWorkspace, IObjectAllProperties, IHasExtent, IHasMofExtentMetaObject
    {
        private static readonly MofExtent XmlMetaExtent =
            new MofUriExtent(new XmiProvider(), null)
            {
                LocalSlimUmlEvaluation = true
            };

        /// <summary>
        /// Stores a list of other extents that shall also be considered as meta extents
        /// </summary>
        private readonly List<IExtent> _metaExtents = new();

        /// <summary>
        /// STores the object for synchronization issues
        /// </summary>
        private readonly object _syncObject = new();

        private DynamicFunctionManager? _dynamicFunctionManager;

        /// <summary>
        /// Stores the information whether the evaluation about the item count is currently
        /// running in the background.
        /// </summary>
        private bool _isItemCountRunning;

        private int _itemCountCached;

        /// <summary>
        /// Initializes a new instance of the Extent
        /// </summary>
        /// <param name="provider">Provider being used for the extent</param>
        /// <param name="scopeStorage">Scope storage to be used to find Change Event Manager</param>
        public MofExtent(IProvider provider, IScopeStorage? scopeStorage = null)
        {
            ChangeEventManager = scopeStorage?.TryGet<ChangeEventManager>();
            ScopeStorage = scopeStorage;

            var rootProvider = new XmiProvider();
            Provider = provider;
            TypeLookup = new DotNetTypeLookup();

            // Defines the Meta Element.
            // The pseudo extent is used to allow the factory to create the correct instance of Xml
            // instead of the specific type.
            if (XmlMetaExtent != null)
            {
                MetaXmiElement = new MofElement(
                    rootProvider.CreateProviderObject(new XElement("meta")),
                    XmlMetaExtent);
                XmlMetaExtent.AddMetaExtent(this);
            }
            else
            {
                MetaXmiElement = new MofElement(
                    rootProvider.CreateProviderObject(new XElement("meta")),
                    this);
            }

            MetaXmiElement.SetMetaClass(_DatenMeister.TheOne.Management.__ExtentProperties);

            ExtentConfiguration = new ExtentConfiguration(this);
        }

        /// <summary>
        /// Stores the configuration for the extent
        /// </summary>
        public ExtentConfiguration ExtentConfiguration { get; }

        /// <summary>
        /// This type lookup can be used to convert the instances of the .Net types to real MOF meta classes.
        /// It is only used, if the data is directly set as a .Net object
        /// </summary>
        public IDotNetTypeLookup TypeLookup { get; }

        /// <summary>
        /// Gets or sets the provider for the given extent
        /// </summary>
        public IProvider Provider { get; }

        /// <summary>
        /// Defines the scope storage in which the extent is working
        /// </summary>
        public IScopeStorage? ScopeStorage { get; private set; }

        /// <summary>
        /// Gets a value whether the extent will support the full Uml capabilities regarding auto enumeration
        /// and default value of properties. For certain extents, especially 'just getting loaded' extents,
        /// the slim evaluation might bring shorter execution times
        /// </summary>
        public bool LocalSlimUmlEvaluation { get; set; }

        /// <summary>
        /// Gets or sets the flag whether the slim evaluation is activated globally
        /// </summary>
        public static bool GlobalSlimUmlEvaluation { get; set; }

        /// <summary>
        /// Gets or sets the effective slim evaluation
        /// </summary>
        public bool SlimUmlEvaluation => LocalSlimUmlEvaluation || GlobalSlimUmlEvaluation;

        /// <summary>
        /// Gets or sets the Dynamic Function Manager which is used to retrieve the properties
        /// </summary>
        public DynamicFunctionManager? DynamicFunctionManager
        {
            get => _dynamicFunctionManager ?? (DynamicFunctionManager = Workspace?.DynamicFunctionManager);
            set => _dynamicFunctionManager = value;
        }

        /// <summary>
        /// Gets the workspace to which the extent is allocated
        /// </summary>
        public Workspace? Workspace { get; set; }

        /// <summary>
        /// Gets or sets the change event manager for the objects within
        /// </summary>
        internal ChangeEventManager? ChangeEventManager { get; set; }

        /// <summary>
        /// Gets or sets the flag indicating whether the extent is modified
        /// </summary>
        public bool IsModified { get; private set; }

        public int ItemCount
        {
            get
            {
                lock (_syncObject)
                {
                    if (_itemCountCached == -1 && !_isItemCountRunning)
                    {
                        _isItemCountRunning = true;
                        Task.Run(() =>
                        {
                            //_itemCountCached = elements().GetAllCompositesIncludingThemselves().size();
                            ChangeEventManager?.SendChangeEvent(this);
                        });
                    }

                    return _itemCountCached;
                }
            }
        }

        /// <summary>
        /// Gets the meta element for xmi data
        /// </summary>
        public MofElement MetaXmiElement { get; set; }

        /// <summary>
        /// Gets or sets the xml Node of the meta element.
        /// Only to be used by ExtentConfigurationLoader and other extent loaders.
        /// This method shall only be called, if the underlying provider does not support storage of metadata
        /// </summary>
        public XElement LocalMetaElementXmlNode
        {
            get => ((XmiProviderObject) MetaXmiElement.ProviderObject).XmlNode;
            set => ((XmiProviderObject) MetaXmiElement.ProviderObject).XmlNode = value;
        }

        /// <summary>
        /// Gets the meta extents
        /// </summary>
        public IEnumerable<IExtent> MetaExtents
        {
            get
            {
                lock (_metaExtents)
                {
                    return _metaExtents.ToList();
                }
            }
        }

        /// <inheritdoc />
        public bool equals(object? other)
        {
            if (other is MofExtent otherAsExtent)
            {
                return Equals(otherAsExtent);
            }

            return false;
        }

        /// <inheritdoc />
        public object? get(string property)
        {
            if (property == _UML._Packages._Package.packagedElement)
            {
                return elements();
            }

            if (Provider.GetCapabilities().StoreMetaDataInExtent)
            {
                var nullObject = Provider.Get(null) ??
                                 throw new InvalidOperationException(
                                     "Provider does not support setting of extent properties");
                return MofObject.ConvertToMofObject(
                    new MofObject(nullObject, this),
                    property,
                    nullObject.GetProperty(property));
            }

            return MetaXmiElement.get(property);
        }

        /// <inheritdoc />
        public void set(string property, object? value)
        {
            if (Provider.GetCapabilities().StoreMetaDataInExtent)
            {
                var nullObject = Provider.Get(null) ??
                                 throw new InvalidOperationException(
                                     "Provider does not support setting of extent properties");

                if (DotNetHelper.IsOfEnumeration(value))
                {
                    if (value == null) throw new InvalidOperationException("value == null");

                    nullObject.EmptyListForProperty(property);
                    foreach (var child in (IEnumerable<object>) value)
                    {
                        var valueForSetting = ConvertForSetting(this, child);
                        if (valueForSetting != null)
                        {
                            nullObject.AddToProperty(property, valueForSetting);
                        }
                    }
                }
                else
                {
                    var valueForSetting = ConvertForSetting(this, value);
                    nullObject.SetProperty(property, valueForSetting);
                }
            }
            else
            {
                MetaXmiElement.set(property, value);
            }

            SignalUpdateOfContent();
        }

        /// <inheritdoc />
        public bool isSet(string property)
        {
            if (Provider.GetCapabilities().StoreMetaDataInExtent)
            {
                var nullObject = Provider.Get(null) ??
                                 throw new InvalidOperationException(
                                     "Provider does not support setting of extent properties");
                return nullObject.IsPropertySet(property);
            }

            return MetaXmiElement.isSet(property);
        }

        /// <inheritdoc />
        public void unset(string property)
        {
            if (Provider.GetCapabilities().StoreMetaDataInExtent)
            {
                var nullObject = Provider.Get(null) ??
                                 throw new InvalidOperationException(
                                     "Provider does not support setting of extent properties");

                nullObject.DeleteProperty(property);
            }
            else
            {
                MetaXmiElement.unset(property);
            }

            SignalUpdateOfContent();
        }

        /// <inheritdoc />
        public bool useContainment() => false;

        /// <inheritdoc />
        public IReflectiveSequence elements() => new ExtentReflectiveSequence(this);

        public IExtent Extent => this;

        /// <summary>
        /// Gets the meta object representing the meta object. Setting, querying a list or getting
        /// is supported by this object
        /// </summary>
        /// <returns>The returned value representing the meta object</returns>
        public MofObject GetMetaObject()
        {
            if (Provider.GetCapabilities().StoreMetaDataInExtent)
            {
                var nullObject = Provider.Get(null) ??
                                 throw new InvalidOperationException(
                                     "Provider does not support setting of extent properties");

                var result = new MofElement(nullObject, this);
                result.SetMetaClass(_DatenMeister.TheOne.Management.__ExtentProperties);
                return result;
            }

            return MetaXmiElement;
        }

        /// <summary>
        /// Gets the workspace via the interface
        /// </summary>
        IWorkspace? IHasWorkspace.Workspace => Workspace;

        /// <summary>
        /// Gets all the properties that are set in the meta information of the extent
        /// </summary>
        /// <returns>Enumeration of strings</returns>
        public IEnumerable<string> getPropertiesBeingSet()
        {
            if (Provider.GetCapabilities().StoreMetaDataInExtent)
            {
                var nullObject = Provider.Get(null) ??
                                 throw new InvalidOperationException(
                                     "Provider does not support setting of extent properties");
                return nullObject.GetProperties();
            }

            return MetaXmiElement.getPropertiesBeingSet();
        }

        /// <summary>
        /// Adds an extent as a meta extent, so it will also be used to retrieve the element
        /// </summary>
        /// <param name="extent">Extent to be added</param>
        public void AddMetaExtent(IExtent extent)
        {
            if (extent == null)
            {
                return;
            }

            lock (_metaExtents)
            {
                if (extent is IUriExtent uriExtent)
                {
                    _metaExtents.RemoveAll(x => (x as IUriExtent)?.contextURI() == uriExtent.contextURI());
                }

                if (_metaExtents.Any(x => x.Equals(extent))) return;

                if (XmlMetaExtent != this)
                {
                    XmlMetaExtent.AddMetaExtent(extent);
                }

                _metaExtents.Add(extent);
            }
        }

        /// <summary>
        /// Adds a number of extents as meta extent to the given extent
        /// </summary>
        /// <param name="extents"></param>
        public void AddMetaExtents(IEnumerable<IExtent> extents)
        {
            foreach (var extent in extents.OfType<IUriExtent>())
            {
                AddMetaExtent(extent);
            }
        }

        /// <summary>
        /// Resolves the DotNetType by navigating through the current and the meta instances.
        /// </summary>
        /// <param name="metaclassUri">Uri class to be retrieved</param>
        /// <param name="resolveType">The resolving strategy</param>
        /// <returns>Resolved .Net Type as IElement</returns>
        public Type? ResolveDotNetType(string metaclassUri, ResolveType resolveType)
        {
            if (resolveType != ResolveType.OnlyMetaClasses)
            {
                var result = TypeLookup.ToType(metaclassUri);
                if (result != null)
                {
                    return result;
                }
            }

            // Now look into the explicit extents
            foreach (var metaExtent in MetaExtents.Cast<MofUriExtent>())
            {
                var element = metaExtent.TypeLookup.ToType(metaclassUri);
                if (element != null)
                {
                    return element;
                }
            }

            var resolve = ResolveDotNetTypeByMetaWorkspaces(metaclassUri, Workspace);
            return resolve;
        }

        /// <summary>
        /// Resolves the the given uri by looking through each meta workspace of the workspace
        /// </summary>
        /// <param name="metaclassUri">Uri being retrieved</param>
        /// <param name="workspace">Workspace whose meta workspaces were queried</param>
        /// <param name="alreadyVisited">Set of all workspaces already being visited. This avoid unnecessary recursion and unlimited recursion</param>
        /// <returns>Found element or null, if not found</returns>
        private Type? ResolveDotNetTypeByMetaWorkspaces(
            string metaclassUri,
            Workspace? workspace,
            HashSet<Workspace>? alreadyVisited = null)
        {
            alreadyVisited ??= new HashSet<Workspace>();
            if (workspace != null && alreadyVisited.Contains(workspace))
            {
                return null;
            }

            if (workspace != null)
            {
                alreadyVisited.Add(workspace);
            }

            // If still not found, look into the meta workspaces. Nevertheless, no recursion
            var metaWorkspaces = workspace?.MetaWorkspaces;
            if (metaWorkspaces != null)
            {
                foreach (var metaWorkspace in metaWorkspaces)
                {
                    foreach (var metaExtent in metaWorkspace.extent.OfType<MofUriExtent>())
                    {
                        var element = metaExtent.TypeLookup.ToType(metaclassUri);
                        if (element != null)
                        {
                            return element;
                        }
                    }

                    var elementByMeta = ResolveDotNetTypeByMetaWorkspaces(metaclassUri, metaWorkspace, alreadyVisited);
                    if (elementByMeta != null)
                    {
                        return elementByMeta;
                    }
                }
            }

            return null;
        }

        /// <summary>
        /// Gets the uri of the metaclass by looking through current extent, meta extent and meta workspaces
        /// </summary>
        /// <param name="type">Type to be converted</param>
        /// <returns>Retrieved meta class uri</returns>
        public string? GetMetaClassUri(Type type)
        {
            var result = TypeLookup.ToElement(type);
            if (!string.IsNullOrEmpty(result))
            {
                return result;
            }

            // Now look into the explicit extents
            foreach (var metaExtent in MetaExtents.OfType<MofExtent>())
            {
                var element = metaExtent.TypeLookup.ToElement(type);
                if (!string.IsNullOrEmpty(element))
                {
                    return element;
                }
            }

            // If still not found, look into the meta workspaces. Nevertheless, no recursion
            var metaWorkspaces = Workspace?.MetaWorkspaces;
            if (metaWorkspaces != null)
            {
                foreach (var metaWorkspace in metaWorkspaces)
                {
                    var metaClassUri = WorkspaceDotNetHelper.GetMetaClassUriOfDotNetType(metaWorkspace, type);
                    if (metaClassUri != null) return metaClassUri;
                }
            }

            return null;
        }

        /// <summary>
        /// Converts the given value to a value which can be used for the provoder
        /// </summary>
        /// <param name="value">Value to be converted</param>
        /// <returns>Converted value</returns>
        public static object ConvertForProviderUsage(object value)
        {
            if (value is MofObject asMofObject)
            {
                return asMofObject.ProviderObject;
            }

            return value;
        }

        /// <summary>
        /// Converts the object to be set by the data provider. This is the inverse object to ConvertToMofObject.
        /// An arbitrary object shall be stored into the database
        /// </summary>
        /// <param name="value">Value to be converted</param>
        /// <returns>The converted object or an exception if the object cannot be converted</returns>
        public object? ConvertForSetting(object value)
            => ConvertForSetting(value, this, null);

        /// <summary>
        /// Converts the given value to an element that can be used be for the provider object
        /// </summary>
        /// <param name="value">Value to be set</param>
        /// <param name="extent">Extent being used to create the factory or being used for .Net TypeLookup</param>
        /// <param name="container">Container which will host the newly created object</param>
        /// <returns>The converted object being ready for Provider</returns>
        public static object? ConvertForSetting(object? value, MofExtent? extent, MofObject? container)
        {
            if (value == null)
            {
                return null;
            }

            if (DotNetHelper.IsOfPrimitiveType(value) || DotNetHelper.IsOfEnum(value))
            {
                return value;
            }

            if (DotNetHelper.IsOfMofShadow(value))
            {
                var asMofObjectShadow = (MofObjectShadow) value;

                // It is a reference
                var reference = new UriReference(asMofObjectShadow.Uri);

                return reference;
            }

            if (DotNetHelper.IsUriReference(value))
            {
                return value;
            }

            if (DotNetHelper.IsOfUriExtent(value))
            {
                if (!(value is IUriExtent ofUriExtent))
                    throw new InvalidOperationException("Should not exist");

                return new UriReference(ofUriExtent.contextURI());
            }

            if (DotNetHelper.IsOfMofObject(value))
            {
                if (extent == null)
                    throw new InvalidOperationException("Extent is null but MofObject given");

                var asMofObject = (MofObject) value;

                if (asMofObject.Extent == null)
                {
                    if (asMofObject.ProviderObject.Provider == extent.Provider)
                    {
                        // if the given value is created by the provider, but has not been allocated
                        // to an object until now, it can be used directly.
                        return asMofObject.ProviderObject;
                    }

                    // If the object to be added is not connected to an extent, we have to copy
                    // the element to the right provider type, but we keep the id
                    var result = (MofElement) ObjectCopier.Copy(
                        new MofFactory(extent),
                        asMofObject,
                        new CopyOption {CopyId = true});
                    return result.ProviderObject;
                }

                // It is a reference
                var asElement = asMofObject as IElement ??
                                throw new InvalidOperationException("Given element is not of type IElement");
                return new UriReference(((MofUriExtent) asMofObject.Extent).uri(asElement));
            }

            if (DotNetHelper.IsOfEnumeration(value))
            {
                return ((IEnumerable) value)
                    .Cast<object>()
                    .Select(innerValue => ConvertForSetting(innerValue, extent, container)).ToList();
            }

            if (DotNetHelper.IsOfProviderObject(value))
            {
                return value;
            }

            // Then, we have a simple dotnet type, that we try to convert. Let's hope, that it works
            if (!(extent is IUriExtent asUriExtent))
            {
                throw new InvalidOperationException(
                    "This element was not created by a factory. So a setting by .Net Object is not possible");
            }

            return ConvertForSetting(DotNetConverter.ConvertToMofObject(asUriExtent, value), extent, container);
        }

        /// <summary>
        /// Converts the object to be set by the data provider. This is the inverse object to ConvertToMofObject.
        /// An arbitrary object shall be stored into the database
        /// </summary>
        /// <param name="recipient">The Mofobject for which the element will be created</param>
        /// <param name="childValue">Value to be converted</param>
        /// <returns>The converted object or an exception if the object cannot be converted</returns>
        public static object? ConvertForSetting(IObject recipient, object? childValue)
        {
            if (recipient == null) throw new ArgumentNullException(nameof(recipient));

            if (recipient is MofObject mofObject)
            {
                var result = ConvertForSetting(childValue, mofObject.ReferencedExtent, mofObject);

                if (result is IProviderObject)
                {
                    if (childValue is MofObject childValueAsObject)
                    {
                        // Sets the extent of the newly added object which will be associated to the mofObject
                        // This value must be set, so the new information is propagated to the MofObjects
                        childValueAsObject.ReferencedExtent = mofObject.Extent ?? mofObject.ReferencedExtent;
                        childValueAsObject.Extent = mofObject.Extent;
                    }
                }

                return result;
            }

            if (recipient is MofExtent extent)
            {
                var result = ConvertForSetting(childValue, extent, null);

                if (result is IProviderObject)
                {
                    if (childValue is MofObject childValueAsObject)
                    {
                        // Sets the extent of the newly added object which will be associated to the mofObject
                        // This value must be set, so the new information is propagated to the MofObjects
                        childValueAsObject.ReferencedExtent = extent;
                        childValueAsObject.Extent = extent;
                    }
                }

                return result;
            }

            throw new NotImplementedException("Type of ${value.GetType()} is not known");
        }

        /// <summary>
        /// Indicates that the content of the extent is updated
        /// </summary>
        /// <param name="isModified">true, if the modification flag shall be set to true</param>
        public void SignalUpdateOfContent(bool isModified = true)
        {
            _itemCountCached = -1;
            IsModified = isModified;
        }
    }
}


text:
def sum_values_above_threshold(value_string, threshold):
    ''' (str, int) -> int

    Precondition: value_string.isdigit() returns True

    Return the sum of the individual digits in value_string that are
    greaterthan threshold.

    >>> sum_values_above_threshold('153382', 4)
    13
    >>> sum_values_above_threshold('12345', 5)
    0
    '''

    sum = 0
    for i in value_string:
        if int(i) > threshold:
            sum += int(i)
    return sum