text:
import rg

# globals for fine-tuning
SPAWN_WEIGHT = 1.0
CANT_EASILY_LEAVE_SPAWN_WEIGHT = 0.5
FIGHTING_FRIENDLY_WEIGHT = 3.75
TO_FIGHT_FRIENDLY_WEIGHT = 1.0
ADJACENT_ENEMIES_WEIGHT = 1.0
ADJACENT_ENEMIES_EXPONENT = 1.0
FRIENDLY_IN_LOC_WEIGHT = 4.0
FRIENDLIES_IN_TROUBLE_WEIGHT = 9.0
REMAIN_BIAS = 0.25
COULD_DIE_WEIGHT = 20.0
CHARGE_WEIGHT = 2.0
ESCAPE_WEIGHT = 1.75
GROUP_WEIGHT = -0.875
ENEMY_IN_LOC_WEIGHT = 34.25
ENEMY_IN_TROUBLE_WEIGHT = 28.75
ENEMY_SUPER_WEAK_WEIGHT = 3.0
NEARBY_FRIENDLIES_IN_SPAWN_WEIGHT = 2.75
NEARBY_FRIENDLIES_IN_DEEP_SPAWN_WEIGHT = 2.75
POSSIBLE_SUICIDERS_WEIGHT = 2.0
SURROUND_WEIGHT = 0.5
MOVE_INTO_ATTACK_WEIGHT = 9.125

#attack weights
FRIENDLY_LOC_ATTACK_WEIGHT = 6.125
ENEMY_ATTACK_HP_WEIGHT = 2.9
ADJACENT_ENEMY_ATTACK_WEIGHT = 5.0
ADJACENT_FRIENDLY_ATTACK_WEIGHT = 1.75
NEARBY_TROUBLED_ENEMY_ATTACK_WEIGHT = 5.375
NEARBY_TROUBLED_FRIENDLY_ATTACK_WEIGHT = 1.25
ATTACK_IN_FUTURE_MOVES_WEIGHT = 20.25
MULTIPLE_ATTACK_WEIGHT = 2.875

# global variable to store the future moves of each ally robot
# we can use this to avoid friendly collisions
future_moves = []
future_attacks = []
# this is used to store the current turn considered by the future_moves array
future_moves_turn = 0

def cant_easily_leave_spawn(loc, game):
    """Returns whether a bot would need 2+ moves to exit the spawn area.
    (i.e. the bot is in spawn and all of the locations around it are occupied/
    obstacle/invalid)"""

    if 'spawn' in rg.loc_types(loc):
        adjacent_locs = rg.locs_around(loc,
                filter_out=['spawn', 'obstacle', 'invalid'])

        all_bots = game.get('robots')

        for loc in adjacent_locs:
            if loc in all_bots:
                adjacent_locs.remove(loc)
        return (len(adjacent_locs) == 0)

    # if the bot is not in spawn, then it can easily leave it
    # by standing still, hehe.
    return False

def bot_is_in_trouble(bot, game):
    """Returns whether a bot is in trouble.
    If a bot could die in the next turn, it is in trouble."""
    return could_die_in_loc(bot.hp, bot.location, bot.player_id, game)

def could_die_in_loc(hp, loc, player_id, game):
    """Returns whether or not a bot could die in a given location,
    based on its hp and player_id.
    Considers the number of enemy bots nearby and whether or not
    the robot is standing on a spawn tile just before more will spawn."""

    adjacent_bots = get_bots_next_to(loc, game)
    adjacent_enemies = [b for b in adjacent_bots if b.player_id != player_id]

    # each adjacent enemy can deal up to 10 damage in a turn
    possible_hp_loss = len(adjacent_enemies) * 10
    if possible_hp_loss >= hp:
        # could die if all of the adjacent_enemies attack
        return True

    if 'spawn' in rg.loc_types(loc):
        if game['turn'] % 10 == 0:
            # next turn, if we remain on the spawn square, it could die
            return True

    return False

def get_weakest_bot(bots):
    """Returns the weakest bot out of a list of bots.
    If no bots exist, returns None"""
    assert len(bots) != 0

    # bots have 50 hp max
    least_hp = 51
    weakest_bot = None

    for bot in bots:
        if bot.hp < least_hp:
            weakest_bot = bot
            least_hp = bot.hp

    return weakest_bot

def get_bots_next_to(location, game):
    """Returns all bots next to a location."""

    all_bots = game.get('robots')
    bots = []
    for loc in all_bots.keys():
        if loc in rg.locs_around(location):
            bots.append(all_bots[loc])
    return bots

def get_bot_in_location(location, game):
    """Returns the bot in the given location."""
    bots = game.get('robots')
    if location in bots.keys():
        return bots[location]
    else:
        return None

def is_possible_suicider(bot, game):
    """Returns whether a bot is a possible suicider based on a kinda
    restrictive algorithm.

    Returns true if the sum of the hp of all enemy bots is greater than
    the bot's hp and there are more than 1 adjacent enemy bots and
    there is at least one adjacent bot that would die."""

    # get all adjacent enemies of suicider
    adjacent_bots = get_bots_next_to(bot.location, game)
    for bot2 in adjacent_bots:
        if bot2.player_id == bot.player_id:
            adjacent_bots.remove(bot2)

    # whether the total possible hp hit would outweigh the
    # hp lost
    if (sum([min(bot2.hp, 15) for bot2 in adjacent_bots]) > bot.hp):
        if len(adjacent_bots) > 1:
            for bot2 in adjacent_bots:
                if bot2.hp <= 15:
                    return True
    return False

class Robot:

    def sort_bots_closest_first(self, bots):
        """Sorts a list of bots sorted closest to farthest away."""
        return sorted(bots, key=lambda b: rg.wdist(self.location, b.location))

    def get_enemy_bots_next_to(self, location, game):
        """Returns the enemy bots next to a location."""
        enemies = []

        for loc in rg.locs_around(location):
            bot = get_bot_in_location(loc, game)
            if (bot) and (bot.player_id != self.player_id):
                enemies.append(bot)

        return enemies

    def get_friendlies_next_to(self, location, game):
        """Returns the friendly bots next to a location.
        Note: does not return /this/ robot.(filters out any robot whose
        location is equal to this robot's location)"""
        friendlies = []

        for loc in rg.locs_around(location):
            bot = get_bot_in_location(loc, game)
            if (bot) and (bot.player_id == self.player_id):
                if bot.location != self.location:
                    friendlies.append(bot)

        return friendlies

    def get_adjacent_enemy_bots(self, game):
        """Returns a list of the adjacent enemy bots."""
        return self.get_enemy_bots_next_to(self.location, game)

    def is_suiciding_beneficial(self, game):
        """Returns whether or not the bot should suicide on this turn."""
        # get the adjacent bots
        adjacent_bots = self.get_adjacent_enemy_bots(game)

        if (sum([min(bot.hp, 15) for bot in adjacent_bots]) > self.hp):

            # see if the bot can escape to any adjacent location
            for loc in rg.locs_around(self.location,
                    filter_out=['invalid', 'obstacle']):
                # the bot can't escape to the location if there's an enemy in it
                if not could_die_in_loc(self.hp, loc, self.player_id, game):
                    bot_in_loc = get_bot_in_location(loc, game)
                    if bot_in_loc and bot_in_loc.player_id != self.player_id:
                        continue
                    else:
                        return False
            return True

    def get_distance_to_closest_bot(self, game, loc=None,
            friendly=False, enemy=False):
        """Returns the distance from the given location (or, by default,
        this robot's location) to the nearest enemy."""
        if not loc:
            loc = self.location
        bots = game.get('robots')
        shortest_distance = 99999

        for bot in bots.values():
            if bot.location != loc and bot.location != self.location:
                if ((friendly is False) and (enemy is False)) or \
                        (enemy and (bot.player_id != self.player_id)) or \
                        (friendly and (bot.player_id == self.player_id)):
                    dist = rg.wdist(loc, bot.location)
                    shortest_distance = min(dist, shortest_distance)
        return shortest_distance

    def act(self, game):
        """The function called by game.py itself: returns the action the robot
        should take this turn."""

        action = []

        # update the future_moves array if necessary
        # only the first robot will do this
        global future_moves_turn, future_moves, future_attacks
        if future_moves_turn != game['turn']:
            future_moves = []
            future_attacks = []
            future_moves_turn = game['turn']

        #adjacent_bots = self.get_adjacent_enemy_bots(game)
        if self.is_suiciding_beneficial(game):
            action = ['suicide']
        else:
            locs = [self.location] + rg.locs_around(self.location,
                    filter_out=['invalid', 'obstacle'])
            target_loc = self.get_best_loc(locs, game)
            if target_loc != self.location:
                action = ['move', target_loc]
            else:
                attack_locs = rg.locs_around(self.location,
                        filter_out=['invalid', 'obstacle'])
                action = ['attack', self.get_best_attack_loc(attack_locs, game)]

        if action[0] == 'move':
            assert not action[1] in future_moves
            future_moves.append(action[1])
            if action[1] == self.location:
                action = ['guard']
        if action[0] == 'attack':
            future_attacks.append(action[1])

        return action

    def get_best_loc(self, locs, game):
        """Returns the best location out of a list.
        The 'goodness' of a tile is determined by get_tile_goodness()."""
        best_loc_weight = -9999
        best_loc = None
        for loc in locs:
            loc_weight = self.get_tile_goodness(loc, game)
            if loc_weight > best_loc_weight:
                best_loc = loc
                best_loc_weight = loc_weight
        assert best_loc
        return best_loc

    def get_enemies_fighting_friendlies(self, enemies, game):
        enemies_fighting_friendlies = []
        for enemy in enemies:
            if self.get_friendlies_next_to(enemy.location, game):
                enemies_fighting_friendlies.append(enemy)
        return enemies_fighting_friendlies

    def get_enemies_to_fight_friendlies(self, enemies):
        enemies_to_fight_friendlies = []
        for enemy in enemies:
            for pos in rg.locs_around(enemy.location):
                if pos in future_moves:
                    enemies_to_fight_friendlies.append(enemy)
                    break
        return enemies_to_fight_friendlies

    def get_tile_goodness(self, loc, game):
        """Returns how 'good' a tile is to move to or stay on.
        Based on a whole bunch of factors. Fine-tuning necessary."""

        types = rg.loc_types(loc)
        enemies_next_to_loc = self.get_enemy_bots_next_to(loc, game)
        enemies_next_to_loc_fighting_friendlies = \
                self.get_enemies_fighting_friendlies(
                        enemies_next_to_loc, game)

        enemies_next_to_loc_to_fight_friendlies = \
                self.get_enemies_to_fight_friendlies(enemies_next_to_loc)

        friendlies_next_to_loc = self.get_friendlies_next_to(loc, game)

        nearby_friendlies_in_spawn = []
        nearby_friendlies_in_deep_spawn = []
        for friendly in friendlies_next_to_loc:
            if 'spawn' in rg.loc_types(friendly.location):
                nearby_friendlies_in_spawn.append(friendly)
                if cant_easily_leave_spawn(friendly.location, game):
                    nearby_friendlies_in_deep_spawn.append(friendly)

        friendly_in_loc = enemy_in_loc = False
        if loc != self.location:
            bot_in_location = get_bot_in_location(loc, game)
            if bot_in_location:
                if bot_in_location.player_id == self.player_id:
                    friendly_in_loc = True
                else:
                    enemy_in_loc = True

        else:
            bot_in_location = None
        distance_to_closest_enemy = self.get_distance_to_closest_bot(game,
                loc=loc, enemy=True)

        distance_to_closest_friendly = self.get_distance_to_closest_bot(game,
                loc=loc, friendly=True)

        nearby_friendlies_in_trouble = []
        for friendly in friendlies_next_to_loc:
            if bot_is_in_trouble(friendly, game):
                nearby_friendlies_in_trouble.append(friendly)

        goodness = 0

        # get out of spawn areas, especially if things are about to spawn
        # highest priority: -50 pts if things are about to spawn
        if game['turn'] <= 90:
            goodness -= ('spawn' in types) * ((game['turn'] % 10 == 0) * 50 + SPAWN_WEIGHT)

        # if the bot can't easily leave spawn (e.g. has to move through
        # more spawn area or an enemy to get out) in the location, that's bad
        # the closer to the spawn timer we are, the worse this is, so
        # multiply it by the game turn % 10
        if game['turn'] <= 90:
            goodness -= cant_easily_leave_spawn(loc, game) * (
                    game['turn'] % 10) * CANT_EASILY_LEAVE_SPAWN_WEIGHT

        # if enemies next to the location are fighting or will fight
        # other friendlies, help them
        goodness += len(enemies_next_to_loc_fighting_friendlies) * FIGHTING_FRIENDLY_WEIGHT

        goodness += len(enemies_next_to_loc_to_fight_friendlies) * TO_FIGHT_FRIENDLY_WEIGHT

        # more enemies next to a location, the worse.
        # even worse if a friendly is already in the location
        #    (so the enemies will target that loc)
        # even worse if our hp is low
        # so exponential because of exponential badness I think
        goodness -= (len(enemies_next_to_loc) * ADJACENT_ENEMIES_WEIGHT) ** ADJACENT_ENEMIES_EXPONENT

        goodness -= friendly_in_loc * FRIENDLY_IN_LOC_WEIGHT

        # slight bias towards NOT moving right next to friendlies
        # a sort of lattice, like
        # X X X X
        #  X X X
        # X X X X
        # is the best shape, I think
        #goodness -= len(friendlies_next_to_loc) * 0.05

        # nearby friendlies in trouble will definitely want to escape this turn
        goodness -= len(nearby_friendlies_in_trouble) * FRIENDLIES_IN_TROUBLE_WEIGHT

        if could_die_in_loc(self.hp, loc, self.player_id, game):
            # /try/ not to go where the bot can die
            # seriously
            goodness -= COULD_DIE_WEIGHT

        # all else remaining the same, move towards the center
        goodness -= rg.dist(loc, rg.CENTER_POINT) * 0.01

        # bias towards remaining in place and attacking
        goodness += (loc == self.location) * REMAIN_BIAS
        # especailly if we're only fighting one bot

        if self.hp > 15:
            # if we are strong enough, move close to (2 squares away) the
            #nearest enemy
            goodness -= max(distance_to_closest_enemy, 2) * CHARGE_WEIGHT
        else:
            #otherwise, run away from the nearest enemy, up to 2 squares away
            goodness += min(distance_to_closest_enemy, 2) * ESCAPE_WEIGHT

        # friendlies should group together
        # if a bot is caught alone, bots that actively hunt and surround,
        # e.g. Chaos Witch Quelaang, will murder them
        # so move up to two tiles from the nearest friendly
        goodness -= min(distance_to_closest_friendly, 2) * GROUP_WEIGHT

        # don't move into an enemy
        # it's slightly more ok to move into an enemy that could die in the
        # next turn by staying here, cause he's likely to either run or die
        # it's perfectly alright, maybe even encouraged, to move into a bot
        # that would die from bumping into you anyways (<=5hp)
        if enemy_in_loc:
            goodness -= enemy_in_loc * ENEMY_IN_LOC_WEIGHT
            goodness += (bot_is_in_trouble(bot_in_location, game) *
                    ENEMY_IN_TROUBLE_WEIGHT)
            goodness += ENEMY_SUPER_WEAK_WEIGHT * (bot_in_location.hp <= 5)

        # don't block friendlies trying to move out of spawn!
        # only matters when things will still spawn in the future, of course
        if game['turn'] <= 90:
            # if they can escape through us
            if not 'spawn' in types:
                goodness -= len(nearby_friendlies_in_spawn) * \
                        NEARBY_FRIENDLIES_IN_SPAWN_WEIGHT
            #especially don't block those who can't easily leave spawn
            # (the two lists overlap, so no extra weighting needed)
            goodness -= len(nearby_friendlies_in_deep_spawn) * \
                    NEARBY_FRIENDLIES_IN_DEEP_SPAWN_WEIGHT

        # don't move next to possible suiciders if our hp is low enough to die
        # from them
        for enemy in enemies_next_to_loc_fighting_friendlies:
            if is_possible_suicider(enemy, game) and (self.hp <= 15):
                goodness -= POSSIBLE_SUICIDERS_WEIGHT

        # the more enemies that could move next to the loc, the worse
        # (the more this bot could be surrounded)
        goodness -= min(len(self.get_enemies_that_could_move_next_to(
            loc, game)), 1) * SURROUND_WEIGHT

        # DON'T move into a square if another bot already plans to move there
        goodness -= 999 * (loc in future_moves)

        #allies attacking the same spot is bad, but not the end of the world..
        # e.g. if a robot needs to go through a spot being attacked by an
        # ally to leave spawn, he DEFINITELY still needs to move there
        goodness -= MOVE_INTO_ATTACK_WEIGHT * (loc in future_attacks)

        return goodness

    def get_enemies_that_could_move_next_to(self, loc, game):
        enemies = []
        for bot in game.get('robots').values():
            if bot.player_id != self.player_id:
                if rg.wdist(bot.location, loc) == 2:
                    enemies.append(bot)
        return enemies

    def get_attack_goodness(self, loc, game):
        """Returns how 'good' attacking a certain location is.
        Based upon the number of friendlies and enemies next to the location,
        any bot that is in the location, etc."""
        enemies_next_to_loc = self.get_enemy_bots_next_to(loc, game)
        friendlies_next_to_loc = self.get_friendlies_next_to(loc, game)
        nearby_friendlies_in_trouble = []
        for friendly in friendlies_next_to_loc:
            if bot_is_in_trouble(friendly, game):
                nearby_friendlies_in_trouble.append(friendly)
        nearby_enemies_in_trouble = []
        for enemy in enemies_next_to_loc:
            if bot_is_in_trouble(enemy, game):
                nearby_enemies_in_trouble.append(enemy)
        robot = get_bot_in_location(loc, game)

        goodness = 0

        if robot:
            if robot.player_id == self.player_id:
                # we're attacking a friendly's location
                # no enemy's gonna move into them...
                goodness -= FRIENDLY_LOC_ATTACK_WEIGHT
            else:
                #attacking an enemy is good
                goodness += (100 - robot.hp) * ENEMY_ATTACK_HP_WEIGHT
        else:

            # no bot is at the location
            # so base the goodness on how likely it is for bots to move there

            #more enemies that can move into the location, the better
            # weighted by 3 because even if there are two other friendlies
            # next to the loc, we still want to attack if it's the only square
            # an enemy is next to
            goodness += len(enemies_next_to_loc) * ADJACENT_ENEMY_ATTACK_WEIGHT

            #enemies aren't too likely to move next to a friendly
            goodness -= len(friendlies_next_to_loc) * \
                    ADJACENT_FRIENDLY_ATTACK_WEIGHT

            # if there are enemies in trouble nearby, we want to try and catch
            # them escaping!
            goodness += len(nearby_enemies_in_trouble) * \
                    NEARBY_TROUBLED_ENEMY_ATTACK_WEIGHT

            # nearby friendlies in trouble will definitely want to escape this
            # turn
            # maybe to this square
            goodness -= len(nearby_friendlies_in_trouble) * \
                    NEARBY_TROUBLED_FRIENDLY_ATTACK_WEIGHT

            # don't attack where an ally is already moving to
            # or attacking, at least not too much
            if loc in future_moves:
                goodness -= ATTACK_IN_FUTURE_MOVES_WEIGHT
            elif loc in future_attacks:
                goodness -=  MULTIPLE_ATTACK_WEIGHT
        return goodness

    def get_best_attack_loc(self, locs, game):
        """Determines the best location to attack out of a list of locations.
        Uses get_attack_goodness() to weigh the locations."""
        best_loc_weight = -9999
        best_loc = None
        for loc in locs:
            loc_weight = self.get_attack_goodness(loc, game)
            if loc_weight > best_loc_weight:
                best_loc = loc
                best_loc_weight = loc_weight
        return best_loc


text:
local find = string.find
-- entries must have colons to set the key and value apart
local function check_for_value(value)
  for i, entry in ipairs(value) do
    local ok = find(entry, ":")
    if not ok then
      return false, "key '"..entry.."' has no value"
    end
  end
  return true
end

return {
  fields = {
    remove = {
      type = "table",
      schema = {
        fields = {
          body = {type = "array", default = {}}, -- does not need colons
          headers = {type = "array", default = {}}, -- does not need colons
          querystring = {type = "array", default = {}} -- does not need colons
        }
      }
    },
    replace = {
      type = "table",
      schema = {
        fields = {
          body = {type = "array", default = {}, func = check_for_value},
          headers = {type = "array", default = {}, func = check_for_value},
          querystring = {type = "array", default = {}, func = check_for_value}
        }
      }
    },
    add = {
      type = "table",
      schema = {
        fields = {
          body = {type = "array", default = {}, func = check_for_value},
          headers = {type = "array", default = {}, func = check_for_value},
          querystring = {type = "array", default = {}, func = check_for_value}
        }
      }
    },
    append = {
      type = "table",
      schema = {
        fields = {
          body = {type = "array", default = {}, func = check_for_value},
          headers = {type = "array", default = {}, func = check_for_value},
          querystring = {type = "array", default = {}, func = check_for_value}
        }
      }
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary"
    tools:context="coin.tracker.zxr.CoinDetailsActivity">

    <TextView
        style="@style/HeaderText1"
        android:id="@+id/tvCoinName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/margin_top"
        android:text="Ethereum"/>

    <TextView
        style="@style/HeaderText2"
        android:id="@+id/tvPrice"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tvCoinName"
        android:layout_marginTop="8dp"
        android:text="@string/rupee_symbol_placeholder"/>

    <LinearLayout
        android:id="@+id/llMyCoinHeader"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tvPrice"
        android:layout_marginTop="@dimen/margin_top"
        android:orientation="vertical">

        <TextView
            android:id="@+id/tvPriceTimeline"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Price - Last 30 days"/>

        <View
            android:layout_width="48dp"
            android:layout_height="2dp"
            android:layout_marginTop="10dp"
            android:background="@color/colorSeparator"/>
    </LinearLayout>

    <RelativeLayout
        android:id="@+id/rlChart"
        android:layout_width="match_parent"
        android:layout_height="240dp"
        android:layout_marginTop="40dp"
        android:layout_below="@id/llMyCoinHeader">

        <com.github.mikephil.charting.charts.LineChart
            android:id="@+id/chart"
            android:layout_height="match_parent"
            android:layout_width="match_parent" />

        <com.wang.avi.AVLoadingIndicatorView
            android:id="@+id/aviLoader"
            style="@style/AVLoadingIndicatorView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:visibility="visible"
            app:indicatorColor="@color/colorAccent"
            app:indicatorName="com.wang.avi.indicators.BallClipRotateIndicator" />
    </RelativeLayout>

</RelativeLayout>


text:
#include "Misc/PropertyFunctionLibrary.h"

UPropertyFunctionLibrary::UPropertyFunctionLibrary(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
}

void UPropertyFunctionLibrary::CopyAllObjectProperties(UObject* SourceObject, UObject* DestObject)
{
	const UClass* SourceClass = SourceObject->GetClass();
	const UClass* DestClass = DestObject->GetClass();
	if (DestObject->IsA(SourceClass))
	{
		for (auto SourceProperty : TFieldRange<const UProperty>(SourceClass))
		{
			auto DestProperty = FindField<UProperty>(DestClass, *SourceProperty->GetNameCPP());
			if (!DestProperty)
			{
				continue;
			}

			const void* Source = SourceProperty->ContainerPtrToValuePtr<void>(SourceObject);
			void* Dest = DestProperty->ContainerPtrToValuePtr<void>(DestObject);
			SourceProperty->CopySingleValue(Dest, Source);
		}
	}
}

void UPropertyFunctionLibrary::CopyObjectProperties(UObject* SourceObject, UObject* DestObject, const TArray<FString>& PropertyNames)
{
	const UClass* SourceClass = SourceObject->GetClass();
	const UClass* DestClass = DestObject->GetClass();
	if (DestObject->IsA(SourceClass))
	{
		for (auto& PropertyName : PropertyNames)
		{
			auto SourceProperty = FindField<UProperty>(SourceClass, *PropertyName);
			if (!SourceProperty)
			{
				continue;
			}

			auto DestProperty = FindField<UProperty>(DestClass, *PropertyName);
			if (!DestProperty)
			{
				continue;
			}

			const void* Source = SourceProperty->ContainerPtrToValuePtr<void>(SourceObject);
			void* Dest = DestProperty->ContainerPtrToValuePtr<void>(DestObject);
			SourceProperty->CopySingleValue(Dest, Source);
		}
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="it_IT">
<context>
    <name>WebAccess</name>
    <message>
        <location filename="webaccess.cpp" line="169"/>
        <source>Loading project...</source>
        <translation>Caricamento progetto...</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="205"/>
        <source>Fixture stored and loaded</source>
        <translation>Fixture salvata e caricata</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="396"/>
        <source>Username and password are required fields.</source>
        <translation>Nome utente e password sono parametri richiesti.</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="402"/>
        <location filename="webaccess.cpp" line="427"/>
        <source>User level has to be a positive integer.</source>
        <translation>Il livello dell'utente deve essere un intero positivo.</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="421"/>
        <source>Username is required.</source>
        <translation>Il nome utente è richiesto.</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="439"/>
        <source>Error while saving passwords file.</source>
        <translation>Errore durante il salvataggio del file delle password.</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="454"/>
        <source>Network configuration changed. Reboot to apply the changes.</source>
        <translation>La configurazione di rete è stata modificata. Riavviare per applicare le modifiche.</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="473"/>
        <source>Autostart configuration changed</source>
        <translation>La configurazione di avvio è stata modificata</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="822"/>
        <source>Widget not supported (yet) for web access</source>
        <translation>Oggetto non ancora supportato via web</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="873"/>
        <location filename="webaccess.cpp" line="925"/>
        <source>Page</source>
        <translation>Pagina</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="1088"/>
        <source>Enable</source>
        <translation>Abilita</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="1120"/>
        <source>Name</source>
        <translation>Nome</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="1121"/>
        <source>Fade In</source>
        <translation>Fade In</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="1122"/>
        <source>Fade Out</source>
        <translation>Fade Out</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="1123"/>
        <source>Duration</source>
        <translation>Durata</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="1124"/>
        <source>Notes</source>
        <translation>Note</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="1360"/>
        <source>Load project</source>
        <translation>Carica progetto</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="1362"/>
        <source>Simple Desk</source>
        <translation>Banco Semplice</translation>
    </message>
    <message>
        <location filename="webaccess.cpp" line="1364"/>
        <source>Configuration</source>
        <translation>Configurazione</translation>
    </message>
</context>
<context>
    <name>WebAccessConfiguration</name>
    <message>
        <location filename="webaccessconfiguration.cpp" line="136"/>
        <source>Passthrough</source>
        <translation>Passthrough</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="210"/>
        <source>Load fixture</source>
        <translation>Carica fixture</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="221"/>
        <source>Username</source>
        <translation>Nome utente</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="222"/>
        <source>Password</source>
        <translation>Password</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="223"/>
        <source>Access level</source>
        <translation>Livello di accesso</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="224"/>
        <source>Action</source>
        <translation>Azione</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="235"/>
        <source>Leave blank to not change</source>
        <translation>Lasciare in bianco per non modificare</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="242"/>
        <location filename="webaccessconfiguration.cpp" line="272"/>
        <source>Only Virtual Console</source>
        <translation>Solo Console Virtuale</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="247"/>
        <location filename="webaccessconfiguration.cpp" line="274"/>
        <source>Virtual Console and Simple Desk</source>
        <translation>Console Virtuale e Banco Semplice</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="252"/>
        <location filename="webaccessconfiguration.cpp" line="276"/>
        <source>Everything</source>
        <translation>Tutto</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="258"/>
        <location filename="webaccessconfiguration.cpp" line="283"/>
        <source>Change</source>
        <translation>Modifica</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="260"/>
        <location filename="webaccessconfiguration.cpp" line="283"/>
        <source>Delete user</source>
        <translation>Elimina utente</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="266"/>
        <source>New username...</source>
        <translation>Nuovo nome utente...</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="267"/>
        <location filename="webaccessconfiguration.cpp" line="285"/>
        <source>New password...</source>
        <translation>Nuova password...</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="284"/>
        <source>Username and password are required fields.</source>
        <translation>Nome utente e password sono parametri richiesti.</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="287"/>
        <source>Add user</source>
        <translation>Aggiungi utente</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="292"/>
        <source>Note: if there isn't at least one user with access level "Everything" on the list authorization will be disabled.</source>
        <translation>Nota: se nella lista non esiste almeno un utente con accesso a "Tutto", l'accesso autorizzato verrà disabilitato.</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="323"/>
        <source>System</source>
        <translation>Sistema</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="332"/>
        <source>Back</source>
        <translation>Indietro</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="340"/>
        <source>Universes configuration</source>
        <translation>Configurazione degli universi</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="347"/>
        <source>Audio configuration</source>
        <translation>Configurazione audio</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="355"/>
        <source>User loaded fixtures</source>
        <translation>Fixture caricate dall'utente</translation>
    </message>
    <message>
        <location filename="webaccessconfiguration.cpp" line="364"/>
        <source>Authorized users</source>
        <translation>Utenti autorizzati</translation>
    </message>
</context>
<context>
    <name>WebAccessNetwork</name>
    <message>
        <location filename="webaccessnetwork.cpp" line="101"/>
        <source>Network interface: </source>
        <translation>Interfaccia di rete:</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="106"/>
        <source>Access point name (SSID): </source>
        <translation>Nome dell'access point (SSID):</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="108"/>
        <source>WPA-PSK Password: </source>
        <translation>Password WPA-PSK:</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="113"/>
        <source>Dynamic (DHCP)</source>
        <translation>Dinamico (DHCP)</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="115"/>
        <source>Static</source>
        <translation>Statico</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="119"/>
        <source>IP Address: </source>
        <translation>Indirizzo IP:</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="121"/>
        <source>Netmask: </source>
        <translation>Maschera:</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="123"/>
        <source>Gateway: </source>
        <translation>Gateway:</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="126"/>
        <location filename="webaccessnetwork.cpp" line="344"/>
        <source>Apply changes</source>
        <translation>Applica le modifiche</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="327"/>
        <source>Back</source>
        <translation>Indietro</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="333"/>
        <source>Network configuration</source>
        <translation>Configurazione di rete</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="338"/>
        <source>Project autostart</source>
        <translation>Progetto di avvio automatico</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="342"/>
        <source>No project</source>
        <translation>Nessun progetto</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="343"/>
        <source>Use current project</source>
        <translation>Usa il progetto corrente</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="348"/>
        <source>Reboot</source>
        <translation>Riavvia</translation>
    </message>
    <message>
        <location filename="webaccessnetwork.cpp" line="349"/>
        <source>Shutdown</source>
        <translation>Arresta</translation>
    </message>
</context>
<context>
    <name>WebAccessSimpleDesk</name>
    <message>
        <location filename="webaccesssimpledesk.cpp" line="50"/>
        <source>Back</source>
        <translation>Indietro</translation>
    </message>
    <message>
        <location filename="webaccesssimpledesk.cpp" line="56"/>
        <source>Page</source>
        <translation>Pagina</translation>
    </message>
    <message>
        <location filename="webaccesssimpledesk.cpp" line="57"/>
        <source>Previous page</source>
        <translation>Pagina precedente</translation>
    </message>
    <message>
        <location filename="webaccesssimpledesk.cpp" line="65"/>
        <source>Next page</source>
        <translation>Pagina successiva</translation>
    </message>
    <message>
        <location filename="webaccesssimpledesk.cpp" line="68"/>
        <source>Reset universe</source>
        <translation>Reimposta universo</translation>
    </message>
    <message>
        <location filename="webaccesssimpledesk.cpp" line="70"/>
        <source>Universe</source>
        <translation>Universo</translation>
    </message>
</context>
</TS>


text:
package edu.umd.cs.findbugs.ba.jsr305;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.security.Permission;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierValidator;
import javax.annotation.meta.When;

import edu.umd.cs.findbugs.SystemProperties;
import edu.umd.cs.findbugs.ba.AnalysisContext;
import edu.umd.cs.findbugs.ba.MissingClassException;
import edu.umd.cs.findbugs.ba.XClass;
import edu.umd.cs.findbugs.ba.XMethod;
import edu.umd.cs.findbugs.classfile.CheckedAnalysisException;
import edu.umd.cs.findbugs.classfile.ClassDescriptor;
import edu.umd.cs.findbugs.classfile.DescriptorFactory;
import edu.umd.cs.findbugs.classfile.Global;
import edu.umd.cs.findbugs.classfile.IAnalysisCache;
import edu.umd.cs.findbugs.classfile.analysis.ClassData;
import edu.umd.cs.findbugs.log.Profiler;
import edu.umd.cs.findbugs.util.DualKeyHashMap;
import edu.umd.cs.findbugs.util.Util;

/**
 * A TypeQualifierValue is a pair specifying a type qualifier annotation and a
 * value. Each TypeQualifierValue is effectively a different type qualifier. For
 * example, if Foo is a type qualifier annotation having an int value, then
 * Foo(0), Foo(1), etc. are all different type qualifiers which must be checked
 * separately.
 *
 * @author William Pugh
 */
public class TypeQualifierValue<A extends Annotation> {
    public static final boolean DEBUG = SystemProperties.getBoolean("tqv.debug");

    private static final ClassDescriptor EXCLUSIVE_ANNOTATION = DescriptorFactory.instance().getClassDescriptor(
            javax.annotation.meta.Exclusive.class);

    private static final ClassDescriptor EXHAUSTIVE_ANNOTATION = DescriptorFactory.instance().getClassDescriptor(
            javax.annotation.meta.Exhaustive.class);

    public final ClassDescriptor typeQualifier;
    public final Class<A> typeQualifierClass;

    public final A proxy;

    public final @CheckForNull Object value;

    private final boolean isStrict;

    private final boolean isExclusive;

    private final boolean isExhaustive;

    private final @CheckForNull
    TypeQualifierValidator<A> validator;

    private final static ClassLoader validatorLoader = new ValidatorClassLoader();

    private TypeQualifierValue(ClassDescriptor typeQualifier, @CheckForNull Object value) {
        this.typeQualifier = typeQualifier;
        this.value = value;
        boolean isStrict = false; // will be set to true if this is a strict
                                  // type qualifier value
        boolean isExclusive = false; // will be set to true if this is an
                                     // exclusive type qualifier value
        boolean isExhaustive = false; // will be set to true if this is an
                                      // exhaustive type qualifier value

        TypeQualifierValidator<A> validator = null;
        Class<A> qualifierClass = null;
        A proxy = null;
        try {
            XClass xclass = Global.getAnalysisCache().getClassAnalysis(XClass.class, typeQualifier);

            // Annotation elements appear as abstract methods in the annotation
            // class (interface).
            // So, if the type qualifier annotation has specified a default When
            // value,
            // it will appear as an abstract method called "when".
            XMethod whenMethod = xclass.findMethod("when", "()Ljavax/annotation/meta/When;", false);
            if (whenMethod == null) {
                isStrict = true;
            }
            for (XMethod xmethod : xclass.getXMethods()) {
                if (xmethod.getName().equals("value") && xmethod.getSignature().startsWith("()")) {
                    isExhaustive = xmethod.getAnnotation(EXHAUSTIVE_ANNOTATION) != null;
                    if (isExhaustive) {
                        // exhaustive qualifiers are automatically exclusive
                        isExclusive = true;
                    } else {
                        // see if there is an explicit @Exclusive annotation
                        isExclusive = xmethod.getAnnotation(EXCLUSIVE_ANNOTATION) != null;
                    }

                    break;
                }
            }
        } catch (MissingClassException e) {
            AnalysisContext.currentAnalysisContext().getLookupFailureCallback().reportMissingClass(e.getClassNotFoundException());
        } catch (CheckedAnalysisException e) {
            AnalysisContext.logError("Error looking up annotation class " + typeQualifier.toDottedClassName(), e);
        }
        this.isStrict = isStrict;
        this.isExclusive = isExclusive;
        this.isExhaustive = isExhaustive;
        ClassDescriptor checkerName = DescriptorFactory.createClassDescriptor(typeQualifier.getClassName() + "$Checker");
        try {
            Global.getAnalysisCache().getClassAnalysis(ClassData.class, checkerName);
            // found it.
//            System.out.println(checkerName);
            SecurityManager m = System.getSecurityManager();
            if (m == null)
                System.setSecurityManager(new ValidationSecurityManager());
            Class<?> c = validatorLoader.loadClass(checkerName.getDottedClassName());
             if (TypeQualifierValidator.class.isAssignableFrom(c)) {
                Class<? extends TypeQualifierValidator> checkerClass = c.asSubclass(TypeQualifierValidator.class);
                validator = getValidator(checkerClass);
                qualifierClass = getQualifierClass(typeQualifier);

                InvocationHandler handler = new InvocationHandler() {

                    public Object invoke(Object arg0, Method arg1, Object[] arg2) throws Throwable {
                       if (arg1.getName() == "value")
                           return TypeQualifierValue.this.value;
                       throw new UnsupportedOperationException("Can't handle " + arg1);
                    }};

                proxy =  qualifierClass.cast(Proxy.newProxyInstance(validatorLoader, new Class[] {qualifierClass}, handler));
            }
        } catch (ClassNotFoundException e) {
            assert true; // ignore
        } catch (CheckedAnalysisException e) {
            assert true; // ignore
        } catch (Exception e) {
            AnalysisContext.logError("Unable to construct type qualifier checker " + checkerName, e);
        } catch (Throwable e) {
            AnalysisContext.logError("Unable to construct type qualifier checker " + checkerName + " due to " + e.getClass().getSimpleName() + ":" + e.getMessage());
        }
        this.validator = validator;
        this.typeQualifierClass = qualifierClass;
        this.proxy = proxy;
    }

    /**
     * @param checkerClass
     * @return
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    @SuppressWarnings("unchecked")
    private TypeQualifierValidator<A> getValidator(Class<? extends TypeQualifierValidator> checkerClass)
            throws InstantiationException, IllegalAccessException {
        return checkerClass.newInstance();
    }

    /**
     * @param typeQualifier
     * @return
     * @throws ClassNotFoundException
     */
    @SuppressWarnings("unchecked")
    private Class<A> getQualifierClass(ClassDescriptor typeQualifier) throws ClassNotFoundException {
        return (Class<A>) validatorLoader.loadClass(typeQualifier.getDottedClassName());
    }

    static class Data {
        /**
         * Cache in which constructed TypeQualifierValues are interned.
         */
        DualKeyHashMap<ClassDescriptor, Object, TypeQualifierValue<?>> typeQualifierMap = new DualKeyHashMap<ClassDescriptor, Object, TypeQualifierValue<?>>();

        /**
         * Set of all known TypeQualifierValues.
         */
        Set<TypeQualifierValue<?>> allKnownTypeQualifiers = new HashSet<TypeQualifierValue<?>>();
    }

    private static ThreadLocal<Data> instance = new ThreadLocal<Data>() {
        @Override
        protected Data initialValue() {
            return new Data();
        }
    };

    public static void clearInstance() {
        instance.remove();
    }

    public boolean canValidate(Object constantValue) {
        if (validator == null)
            return false;
        return true;
    }

    private static final InheritableThreadLocal<AtomicBoolean> performingValidation
        = new InheritableThreadLocal<AtomicBoolean>() {
        @Override protected AtomicBoolean initialValue() {
            return new AtomicBoolean();
        }

    };

    static final class ValidationSecurityManager extends SecurityManager {
        @Override
        public void checkPermission(Permission perm) {
//            System.out.println("Checking " + perm);
            if (performingValidation.get().get())
                throw new SecurityException("not permissions granted while performing JSR-305 validation");
        }
        @Override
        public void checkPermission(Permission perm, Object context) {
            if (performingValidation.get().get())
                throw new SecurityException("not permissions granted while performing JSR-305 validation");
        }
    }

    public When validate(Object constantValue) {
        if (validator == null)
            throw new IllegalStateException("No validator");
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        Profiler profiler = analysisCache.getProfiler();
        profiler.start(validator.getClass());
        AtomicBoolean performing = performingValidation.get();
        try {
            if (!performing.compareAndSet(false, true)) {
                throw new IllegalStateException("recursive validation");
            }

            return validator.forConstantValue(proxy, constantValue);
        } catch (Exception e) {
            AnalysisContext.logError("Error executing custom validator for " + typeQualifier + " " + constantValue, e);
            return When.UNKNOWN;
        } finally {
            if (!performing.compareAndSet(true, false)) {
                throw new IllegalStateException("performingValidation not set when validation completes");
            }
            profiler.end(validator.getClass());

        }
    }

    /**
     * Given a ClassDescriptor/value pair, return the interned
     * TypeQualifierValue representing that pair.
     *
     * @param desc
     *            a ClassDescriptor denoting a type qualifier annotation
     * @param value
     *            a value
     * @return an interned TypeQualifierValue object
     */
    public static @Nonnull
    TypeQualifierValue<?> getValue(ClassDescriptor desc, Object value) {
        DualKeyHashMap<ClassDescriptor, Object, TypeQualifierValue<?>> map = instance.get().typeQualifierMap;
        TypeQualifierValue<?> result = map.get(desc, value);
        if (result != null)
            return result;
        result = new TypeQualifierValue(desc, value);
        map.put(desc, value, result);
        instance.get().allKnownTypeQualifiers.add(result);
        return result;
    }
    @SuppressWarnings("unchecked")
    public static @Nonnull <A extends Annotation>
    TypeQualifierValue<A> getValue(Class <A> clazz, Object value) {
        return (TypeQualifierValue<A>) getValue(DescriptorFactory.createClassDescriptor(clazz), value);
    }

    /**
     * Get Collection of all known TypeQualifierValues.
     *
     * @return Collection of all known TypeQualifierValues
     */
    public static Collection<TypeQualifierValue<?>> getAllKnownTypeQualifiers() {
        return Collections.unmodifiableSet(instance.get().allKnownTypeQualifiers);
    }

    /**
     * Get the "complementary" TypeQualifierValues for given exclusive type
     * qualifier.
     *
     * @param tqv
     *            a type qualifier (which must be exclusive)
     * @return Collection of complementary exclusive type qualifiers
     */
    public static Collection<TypeQualifierValue> getComplementaryExclusiveTypeQualifierValue(TypeQualifierValue tqv) {
        assert tqv.isExclusiveQualifier();

        LinkedList<TypeQualifierValue> result = new LinkedList<TypeQualifierValue>();

        for (TypeQualifierValue t : instance.get().allKnownTypeQualifiers) {
            //
            // Any TypeQualifierValue with the same
            // annotation class but a different value is a complementary
            // type qualifier.
            //
            if (t.typeQualifier.equals(tqv.typeQualifier) && !Util.nullSafeEquals(t.value, tqv.value)) {
                result.add(t);
            }
        }

        return result;
    }

    /**
     * Determine whether or not given TypeQualifierValue has multiple variants.
     * I.e., if Color is a type qualifier having values RED, GREEN, and BLUE,
     * then there are 3 variants, Color(RED), Color(GREEN), and COLOR(BLUE).
     *
     * @param tqv
     *            a TypeQualifierValue
     * @return true if there are multiple variants of this type qualifier, false
     *         otherwise
     */
    public static boolean hasMultipleVariants(TypeQualifierValue tqv) {
        int count = 0;
        for (TypeQualifierValue t : instance.get().allKnownTypeQualifiers) {
            if (t.typeQualifier.equals(tqv.typeQualifier)) {
                count++;
            }
        }
        return count > 1;
    }

    /**
     * Get the ClassDescriptor which specifies the type qualifier annotation.
     *
     * @return ClassDescriptor which specifies the type qualifier annotation
     */
    public ClassDescriptor getTypeQualifierClassDescriptor() {
        return typeQualifier;
    }

    /**
     * Return whether or not this TypeQualifierValue denotes a strict qualifier.
     *
     * @return true if type qualifier is strict, false otherwise
     */
    public boolean isStrictQualifier() {
        return isStrict;
    }

    /**
     * Return whether or not this TypeQualifierValue denotes an exclusive
     * qualifier.
     *
     * @return true if type qualifier is exclusive, false otherwise
     */
    public boolean isExclusiveQualifier() {
        return isExclusive;
    }

    /**
     * Return whether or not this TypeQualifierValue denotes an exhaustive
     * qualifier.
     *
     * @return true if type qualifier is exhaustive, false otherwise
     */
    public boolean isExhaustiveQualifier() {
        return isExhaustive;
    }

    @Override
    public int hashCode() {
        int result = typeQualifier.hashCode();
        if (value != null)
            result += 37 * value.hashCode();
        return result;
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof TypeQualifierValue))
            return false;
        TypeQualifierValue other = (TypeQualifierValue) o;
        return typeQualifier.equals(other.typeQualifier) && Util.nullSafeEquals(value, other.value);
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder();
        buf.append(typeQualifier.toString());
        if (value != null) {
            buf.append(':');
            buf.append(value.toString());
        }
        return buf.toString();
    }

}


text:
import * as _ from 'lodash';

import EventEmitter from './utils/eventEmitter';
import logger from '../../shared/utils/logger';
import { Key } from './types';

export type HotkeyMapping = {
  [name: string]: Array<Array<Key>>
};

export type HotkeyMappingPerMode = {[mode: string]: HotkeyMapping};

// for each mode, keeps a set of hotkeys
// simple wrapper class, no sanity checks
export default class KeyMappings extends EventEmitter {
  public mappings: HotkeyMappingPerMode;

  public static merge(first: KeyMappings, second: KeyMappings) {
    const getMerged = () => {
      const mappings = _.cloneDeep(first.mappings);
      Object.keys(second.mappings).forEach((mode) => {
        mappings[mode] = Object.assign(mappings[mode] || {}, second.mappings[mode]);
      });
      return mappings;
    };
    const merged = new KeyMappings(getMerged());

    first.on('update', () => merged.setMappings(getMerged()));
    second.on('update', () => merged.setMappings(getMerged()));
    return merged;
  }

  constructor(mappings: HotkeyMappingPerMode) {
    super();
    this.mappings = _.cloneDeep(mappings);
  }

  public setMappings(mappings: HotkeyMappingPerMode) {
    this.mappings = mappings;
    this.emit('update');
  }

  public serialize() {
    return _.cloneDeep(this.mappings);
  }

  private _registerMapping(mode: string, keySequence: Array<Key>, name: string) {
    let mappings_for_mode = this.mappings[mode];
    if (!mappings_for_mode) {
      mappings_for_mode = {};
      this.mappings[mode] = mappings_for_mode;
    }
    let sequences_for_name = mappings_for_mode[name];
    if (!sequences_for_name) {
      sequences_for_name = [];
      mappings_for_mode[name] = sequences_for_name;
    }
    sequences_for_name.push(keySequence);
  }

  public registerMapping(mode: string, keySequence: Array<Key>, name: string) {
    this._registerMapping(mode, keySequence, name);
    this.emit('update');
  }

  public registerModeMappings(mode: string, mappings: HotkeyMapping) {
    Object.keys(mappings).forEach((name) => {
      const keySequences = mappings[name];
      keySequences.forEach((sequence) => this._registerMapping(mode, sequence, name));
    });
    this.emit('update');
  }

  // TODO: future dont require name for this
  // also sanity check collisions in registration
  private _deregisterMapping(mode: string, keySequence: Array<Key>, name: string) {
    const mappings_for_mode = this.mappings[mode];
    if (!mappings_for_mode) {
      logger.warn(`Nothing to deregister for mode ${mode}`);
      return;
    }
    let sequences_for_name = mappings_for_mode[name];
    if (!(sequences_for_name && sequences_for_name.length)) {
      logger.warn(`No sequences to deregister for ${name} in mode ${mode}`);
      return;
    }
    sequences_for_name = sequences_for_name.filter((sequence) => {
      return JSON.stringify(sequence) !== JSON.stringify(keySequence);
    });
    mappings_for_mode[name] = sequences_for_name;
  }

  public deregisterMapping(mode: string, keySequence: Array<Key>, name: string) {
    this._deregisterMapping(mode, keySequence, name);
    this.emit('update');
  }

  public deregisterModeMappings(mode: string, mappings: HotkeyMapping) {
    Object.keys(mappings).forEach((name) => {
      const keySequences = mappings[name];
      keySequences.forEach((sequence) => this._deregisterMapping(mode, sequence, name));
    });
    this.emit('update');
  }
}


text:
#include "luaio.h"
#include "luaio_init.h"
#include "luaio_http_parser.h"

#define luaio_http_check_http_parser(L, name) \
  http_parser_t *parser = lua_touserdata(L, 1); \
  if (parser == NULL) { \
    return luaL_argerror(L, 1, "http_parser:"#name" error: http_parser must be userdata\n"); \
  }

#define luaio_http_check_buffer(L, name) \
  luaio_buffer_t *buffer = lua_touserdata(L, 2); \
  if (buffer == NULL || buffer->type != LUAIO_TYPE_READ_BUFFER) { \
    return luaL_argerror(L, 2, "http_parser:"#name" error: buffer must be ReadBuffer\n"); \
  }

static char luaio_http_parser_metatable_key;

/* @example: local parser = http.new_parser() */
static int luaio_http_new_parser(lua_State *L) {
  http_parser_t *parser = lua_newuserdata(L, sizeof(http_parser_t));
  if (parser == NULL) {
    lua_pushnil(L);
    return 1;
  }

  http_parser_init(parser);

  lua_pushlightuserdata(L, &luaio_http_parser_metatable_key);
  lua_rawget(L, LUA_REGISTRYINDEX);
  lua_setmetatable(L, -2);
  return 1;
}

/* @example: local status_code, http_major, http_minor, status, error = http_parser:parse_status_line(read_buffer)
 * @param: read_buffer {userdate(ReadBuffer)}
 * @return: status_code {integer}
 * @return: http_major {integer}
 * @return: http_minor {integer}
 * @return: status {string}
 * @return: error {integer}
 */
static int luaio_http_parser_parse_status_line(lua_State *L) {
  luaio_http_check_http_parser(L, parse_status_line(buffer));
  luaio_http_check_buffer(L, parse_status_line(buffer));

  int rest_size, dist;
  char *start, *last_pos;
  char *read_pos = buffer->read_pos;
  char *write_pos = buffer->write_pos;
  int ret = http_parse_status_line(parser, read_pos, write_pos);
  last_pos = parser->last_pos;

  if (ret == HTTP_OK) {
    lua_pushinteger(L, parser->status_code);
    lua_pushinteger(L, parser->http_major);
    lua_pushinteger(L, parser->http_minor);

    if (parser->status.base != NULL) {
      lua_pushlstring(L, parser->status.base, parser->status.len);
    } else {
      lua_pushnil(L);
    }

    lua_pushinteger(L, ret);

    if (last_pos == write_pos) {
      start = buffer->start;
      buffer->read_pos = start;
      buffer->write_pos = start;
    } else {
      buffer->read_pos = last_pos;
    }
    parser->last_pos = NULL;

    return 5;
  }

  if (ret == HTTP_AGAIN && write_pos == buffer->end) {
    start = buffer->start;

    /* start == read_pos   write_pos == end
     * |                           |
     * +++++++++++++++++++++++++++++
     */
    if (read_pos == start) {
      lua_pushnil(L);
      lua_pushnil(L);
      lua_pushnil(L);
      lua_pushnil(L);
      lua_pushinteger(L, HTTP_ERROR);
      return 5;
    }

    /* start  read_pos   write_pos == end
     * |        |                   |
     * ---------+++++++++++++++++++++
     */
    rest_size = write_pos - read_pos;
    dist = read_pos - start;

    luaio_memmove(start, read_pos, rest_size);
    buffer->read_pos = start;
    buffer->write_pos = start + rest_size;
    parser->last_pos = last_pos - dist;
  }

  lua_pushnil(L);
  lua_pushnil(L);
  lua_pushnil(L);
  lua_pushnil(L);
  lua_pushinteger(L, ret);
  return 5;
}

/* @example: local method, http_major, http_minor, url, error = http_parser:parse_request_line(read_buffer)
 * @param: read_buffer {userdate(ReadBuffer)}
 * @return: method {integer}
 * @return: http_major {integer}
 * @return: http_minor {integer}
 * @return: url {table} @http_parser:parse_request_line
 *    local url = {
 *      schema = {string}
 *      auth = {string}
 *      host = {string}
 *      port = {string}
 *      path = {string}
 *      query = {string}
 *      hash = {string}
 *    }
 * @return: error {integer}
 */
static int luaio_http_parser_parse_request_line(lua_State *L) {
  luaio_http_check_http_parser(L, parse_request_line(buffer));
  luaio_http_check_buffer(L, parse_request_line(buffer));

  int rest_size, dist;
  char *start, *last_pos;
  char *read_pos = buffer->read_pos;
  char *write_pos = buffer->write_pos;
  int ret = http_parse_request_line(parser, read_pos, write_pos);
  last_pos = parser->last_pos;

  if (ret == HTTP_OK) {
    http_url_t *url = &parser->url;
    char *server = url->server.base;
    size_t length = url->server.len;
    if (server && length > 0) {
      ret = http_parse_host(url, server, length, parser->found_at);
      if (ret) goto BAD_REQUEST;
    }

    /* host must be present if there is a schema */
    /* parsing http:///toto will fail */
    if (url->schema.base != NULL && url->host.base == NULL) goto BAD_REQUEST;

    /* CONNECT requests can only contain "hostname:port" */
    if (parser->method == HTTP_CONNECT) {
      if (url->host.base != NULL && url->port.base != NULL) {
        if (url->userinfo.base != NULL
            || url->path.base != NULL
            || url->query.base != NULL
            || url->fragment.base != NULL) {
          goto BAD_REQUEST;
        }
      } else {
        goto BAD_REQUEST;
      }
    }

    lua_pushinteger(L, parser->method);
    lua_pushinteger(L, parser->http_major);
    lua_pushinteger(L, parser->http_minor);
    lua_createtable(L, 0, 7);
    if (url->schema.base != NULL) {
      luaio_setlstring("schema", url->schema.base, url->schema.len)
    }

    if (url->userinfo.base != NULL) {
      luaio_setlstring("auth", url->userinfo.base, url->userinfo.len)
    }

    if (url->host.base != NULL) {
      luaio_setlstring("host", url->host.base, url->host.len)
    }

    if (url->port.base != NULL) {
      luaio_setlstring("port", url->port.base, url->port.len)
    }

    if (url->path.base != NULL) {
      luaio_setlstring("path", url->path.base, url->path.len)
    }

    if (url->query.base != NULL) {
      luaio_setlstring("query", url->query.base, url->query.len)
    }

    if (url->fragment.base != NULL) {
      luaio_setlstring("hash", url->fragment.base, url->fragment.len)
    }
    lua_pushinteger(L, ret);

    if (last_pos == write_pos) {
      start = buffer->start;
      buffer->read_pos = start;
      buffer->write_pos = start;
    } else {
      buffer->read_pos = last_pos;
    }
    parser->last_pos = NULL;

    return 5;
  }

  if (ret == HTTP_AGAIN && write_pos == buffer->end) {
    start = buffer->start;

    /* start == read_pos   write_pos == end
     * |                           |
     * +++++++++++++++++++++++++++++
     */
    if (read_pos == start) {
      lua_pushnil(L);
      lua_pushnil(L);
      lua_pushnil(L);
      lua_pushnil(L);
      lua_pushinteger(L, HTTP_REQUEST_URI_TOO_LARGE);
      return 5;
    }

    /* start  read_pos   write_pos == end
     * |        |                   |
     * ---------+++++++++++++++++++++
     */
    rest_size = write_pos - read_pos;
    dist = read_pos - start;

    luaio_memmove(start, read_pos, rest_size);
    buffer->read_pos = start;
    buffer->write_pos = start + rest_size;
    parser->last_pos = last_pos - dist;
    http_url_t *url = &parser->url;
    if (url->schema.base != NULL) {
      url->schema.base -= dist;
    }

    if (url->server.base != NULL) {
      url->server.base -= dist;
    }

    if (url->path.base != NULL) {
      url->path.base -= dist;
    }

    if (url->query.base != NULL) {
      url->query.base -= dist;
    }

    if (url->fragment.base != NULL) {
      url->fragment.base -= dist;
    }
  }

  lua_pushnil(L);
  lua_pushnil(L);
  lua_pushnil(L);
  lua_pushnil(L);
  lua_pushinteger(L, ret);
  return 5;

BAD_REQUEST:
    fprintf(stderr, "test: %d\n", HTTP_BAD_REQUEST);
  lua_pushnil(L);
  lua_pushnil(L);
  lua_pushnil(L);
  lua_pushnil(L);
  lua_pushinteger(L, HTTP_BAD_REQUEST);
  return 5;
}

/* @example: local error = http_parser:parse_headers(read_buffer, headers, cookies)
 * @param: read_buffer {userdate(ReadBuffer)}
 * @param: headers {table(map)}
 * @param: cookies {table(array)}
 * @return: error {integer}
 * @example:
 *    local headers = {}
 *    local cookies = {}
 *    local error = http_parser:parse_headers(read_buffer, headers, cookies)
 */
static int luaio_http_parser_parse_headers(lua_State *L) {
  luaio_http_check_http_parser(L, parse_headers(buffer));
  luaio_http_check_buffer(L, parse_headers(buffer));

  http_buf_t headers[HTTP_MAX_HEADERS_PER_READ * 2];
  size_t nheader = 0;

  char *start, *last_pos;
  char *read_pos = buffer->read_pos;
  char *write_pos = buffer->write_pos;
  int ret = http_parse_headers(parser, read_pos, write_pos, headers, &nheader);
  last_pos = parser->last_pos;

  assert(nheader <= HTTP_MAX_HEADERS_PER_READ);
  if (nheader > 0) {
    size_t ncookie = lua_rawlen(L, 4);

    char *field, *value;
    size_t field_len, value_len, field_index, value_index;
    for (size_t i = 0; i < nheader; i++) {
      field_index = i << 1;
      value_index = field_index + 1;
      field = headers[field_index].base;
      field_len = headers[field_index].len;
      value = headers[value_index].base;
      value_len = headers[value_index].len;

      if (value != NULL) {
        if ((field_len == 6 && luaio_streq(field, "cookie", 6))
            || (field_len == 10 && luaio_streq(field, "set-cookie", 10))) {
          lua_pushlstring(L, value, value_len);
          lua_rawseti(L, 4, ncookie++);
        } else {
          lua_pushlstring(L, field, field_len);
          lua_pushlstring(L, value, value_len);
          lua_rawset(L, 3);
        }
      }
    }
  }

  if (ret == HTTP_OK || ret == HTTP_DONE) {
    if (last_pos == write_pos) {
      start = buffer->start;
      buffer->read_pos = start;
      buffer->write_pos = start;
    } else {
      buffer->read_pos = last_pos;
    }
    parser->last_pos = NULL;
  } else if (ret == HTTP_AGAIN) {
    if (write_pos == buffer->end) {
      start = buffer->start;

      /* start == read_pos   write_pos == end
       * |                           |
       * +++++++++++++++++++++++++++++
       */
      if (read_pos == start) {
        lua_pushinteger(L, HTTP_BAD_REQUEST);
        return 1;
      }

      /* start  read_pos   write_pos == end
       * |        |                   |
       * ---------+++++++++++++++++++++
       */
      uint8_t index = parser->index;
      if (index == 0) {
        buffer->read_pos = start;
        buffer->write_pos = start;
        parser->last_pos = NULL;
      } else {
        read_pos = parser->field.base;
        int rest_size = write_pos - read_pos;
        luaio_memmove(start, read_pos, rest_size);
        buffer->read_pos = start;
        write_pos = start + rest_size;
        buffer->write_pos = write_pos;
        parser->last_pos = write_pos;

        if (index == 3) {
          char* value_base = parser->value.base;
          rest_size = value_base - read_pos;
          parser->value.base = start + rest_size;
        }

        parser->field.base = start;
      }
    }
  }

  lua_pushinteger(L, ret);
  return 1;
}

static int luaio_http_parser_reset(lua_State *L) {
  luaio_http_check_http_parser(L, reset());
  http_parser_init(parser);
  return 0;
}

static int luaio_http_parse_url(lua_State *L) {
  http_url_t url;
  size_t len;
  char *str = (char*)luaL_checklstring(L, 1, &len);
  int is_connect = lua_toboolean(L, 2);

  int ret = http_parse_url(&url, str, len, is_connect);
  if (ret) {
    lua_pushnil(L);
  } else {
    lua_createtable(L, 0, 7);
    if (url.schema.base != NULL) {
      luaio_setlstring("schema", url.schema.base, url.schema.len)
    }

    if (url.userinfo.base != NULL) {
      luaio_setlstring("auth", url.userinfo.base, url.userinfo.len)
    }

    if (url.host.base != NULL) {
      luaio_setlstring("host", url.host.base, url.host.len)
    }

    if (url.port.base != NULL) {
      luaio_setlstring("port", url.port.base, url.port.len)
    }

    if (url.path.base != NULL) {
      luaio_setlstring("path", url.path.base, url.path.len)
    }

    if (url.query.base != NULL) {
      luaio_setlstring("query", url.query.base, url.query.len)
    }

    if (url.fragment.base != NULL) {
      luaio_setlstring("hash", url.fragment.base, url.fragment.len)
    }
  }

  return 1;
}

static void luaio_http_setup_constants(lua_State *L) {
#define XX(num, name, _) \
  lua_pushinteger(L, num); \
  lua_setfield(L, -2, #name);

  HTTP_METHOD_MAP(XX)
#undef XX

  lua_pushinteger(L, HTTP_OK);
  lua_setfield(L, -2, "OK");

  lua_pushinteger(L, HTTP_DONE);
  lua_setfield(L, -2, "DONE");

  lua_pushinteger(L, HTTP_AGAIN);
  lua_setfield(L, -2, "AGAIN");

  lua_pushinteger(L, HTTP_ERROR);
  lua_setfield(L, -2, "ERROR");
}

int luaopen_http(lua_State *L) {
  /*http_Parser metatable*/
  luaL_Reg http_parser_mtlib[] = {
    { "parse_status_line", luaio_http_parser_parse_status_line },
    { "parse_request_line", luaio_http_parser_parse_request_line },
    { "parse_headers", luaio_http_parser_parse_headers },
    { "reset", luaio_http_parser_reset },
    { NULL, NULL }
  };

  lua_pushlightuserdata(L, &luaio_http_parser_metatable_key);
  luaL_newlib(L, http_parser_mtlib);
  lua_pushvalue(L, -1);
  lua_setfield(L, -2, "__index");
  lua_rawset(L, LUA_REGISTRYINDEX);

  luaL_Reg lib[] = {
    { "new_parser", luaio_http_new_parser },
    { "parse_url", luaio_http_parse_url },
    { "__newindex", luaio_cannot_change },
    { NULL, NULL }
  };

  lua_createtable(L, 0, 0);

  luaL_newlib(L, lib);
  lua_pushvalue(L, -1);
  lua_setfield(L, -2, "__index");
  lua_pushliteral(L, "metatable is protected.");
  lua_setfield(L, -2, "__metatable");
  luaio_http_setup_constants(L);

  lua_setmetatable(L, -2);

  return 1;
}


text:
class CreateWeelerSeos < ActiveRecord::Migration[4.2]
  def change
    create_table :weeler_seos do |t|
      t.string :title
      t.text :description
      t.text :keywords
      t.string :section
      t.references :seoable, index: true, polymorphic: true

      t.timestamps
    end
    add_index :weeler_seos, :section
  end
end


text:
+++
[menu.main]
Name = "Lamda"
identifier = "Lamda"
parent = "Amazon Web Services"
+++

# Lamda

- serverless architecture


text:
/* Mobile Home Page */

header.junior-intro {
  padding: 10px;
  text-align: center;
  background: #3d3d3d;
  color: white;
}

.divider-list {
  margin: 0;
}

.carousel-container {
  width: 100%;
  overflow: hidden;
}

.carousel-list {
  width: 300%;
  list-style-type: none;
}

.carousel-item {
  width: 33.33333%;
  color: white;
  height: 200px;
  text-align: center;
  font-weight: lighter;
  font-size: 1.8em;
  padding: 10px 0;
  float: left;
}

.show-more-button {
  margin: 10px;
}

.carousel-item summary {
  width: 80%;
  margin: auto;
}

.carousel-item.native-look-and-feel {
  background-image: url('../images/green-bg.jpeg');
}

.feature-icon {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  height: 50%;
  width: 50%;
  margin: auto;
}

.native-look-and-feel .feature-icon {
  background-image: url('../images/css3_white.png');
}

.carousel-content {
  background-image: url('../images/red-bg.jpeg');
}

.carousel-content i {
  font-size: 4.0em;
}

.carousel-item.backbone-content {
  background-image: url('../images/blue-bg.jpeg');
}

.backbone-content .feature-icon {
  background-image: url('../images/backbone-white.png');
  height: 40%;
  margin-top: 20px;
}

.carousel-navigation-container {
  position: fixed;
  bottom: 10px;
  width: 100%;
}

.carousel-navigation {
  list-style-type: none;
  margin: auto;
  width: 93px;
}

.carousel-navigation li {
  width: 15px;
  height: 15px;
  background: white;
  float: left;
  opacity: .5;
  -webkit-border-radius: 10px 10px;
  -moz-border-radius: 10px 10px;
  margin: 8px;
  -webkit-transition: opacity .5s;
  -moz-transition: opacity .5s;
  cursor: pointer;
}

.carousel-navigation li.active {
  opacity: 1;
}

/* Mobile Ratchet Page */

.ratchet-content {
  padding: 10px;
}

.ratchet-examples {
  margin: 10px 0;
}

.example-toggle {
  float: left;
  margin: 10px 0;
  cursor: pointer;
}

.example-cnts {
  float: right;
  margin: 14px;
}

/* Mobile Pushstate Example */

.pushstate-content {
  padding: 10px;
}

.pushstate-content .icon-umbrella {
  font-size: 14em;
  margin: auto;
  width: 100%;
  text-align: center;
  display: block;
  line-height: 160px;
}

.pushstate-content p {
  font-size: 1.4em;
}

/** Docs **/

.docs-content {
  display: none;
}

@media screen and (min-width : 600px) {

  #iphone-window {
    position: absolute;
    width: 320px;
    height: 528px;
    top: 147px;
    right: 10%;
    overflow: hidden;
  }

  #iphone-window #app-container,
  #iphone-window .bar-title,
  #iphone-window .content {
    position: absolute;
  }

  .docs-content {
    display: block;
  }

  body {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  }
}

body {
  position: static;
}

.main-docs-content {
  margin-top: 70px;
}

.main-docs-content .hero-unit {
  min-height: 480px;
}

.main-docs-content .hero-unit p {
  margin-right: 400px;
}

.main-docs-content .hero-unit h1 {
  font-size: 6em;
}

#iphone-window {
  background: #ffffff;
}

#iphone-image {
  background-image: url('../images/iphone.png');
  width: 375px;
  height: 806px;
  position: absolute;
  top: 0px;
  right: 10%;
  margin-right: -28px;
}

.navbar-fixed-top {
  top: -5px
}

.navbar-fixed-top .brand {
  padding-top: 5px;
}

.hero-unit ul, ul.padded {
  padding-left: 30px;
}

.hero-unit ul {
  margin-right: 400px;
}

.hero-unit .btn-success {
  font-size: 2em;
  margin: 20px;
}

footer {
  height: 50px;
}

/* Fix stuff that bootstrap breaks */
#iphone-window .bar-title h1 {
  margin: 0;
}

.container {
  margin-right: 8%;
  margin-left: 8%;
  width: 84%;
}

/* Fix stuff that ratchet breaks */
.twitter-follow-button, .twitter-share-button {
  background: none;
  border: none;
  cursor: default;
  box-shadow: none;
  margin-top: -2px;
}

.social-media-btns {
  position: absolute;
  bottom: 20px;
}


text:
using System;

namespace Atata
{
    /// <summary>
    /// Represents the base class for editable field controls.
    /// It can be used for controls like <c><input></c>, <c><select></c> and other editable controls.
    /// </summary>
    /// <typeparam name="T">The type of the control's data.</typeparam>
    /// <typeparam name="TOwner">The type of the owner page object.</typeparam>
    public abstract class EditableField<T, TOwner> : Field<T, TOwner>
        where TOwner : PageObject<TOwner>
    {
        protected EditableField()
        {
        }

        /// <summary>
        /// Gets the <see cref="DataProvider{TData, TOwner}"/> instance for the value indicating whether the control is read-only.
        /// By default checks <c>readonly</c> attribute of scope element.
        /// Override <see cref="GetIsReadOnly"/> method to change the behavior.
        /// </summary>
        public DataProvider<bool, TOwner> IsReadOnly => GetOrCreateDataProvider("read-only state", GetIsReadOnly);

        /// <summary>
        /// Gets the assertion verification provider that has a set of verification extension methods.
        /// </summary>
        public new FieldVerificationProvider<T, EditableField<T, TOwner>, TOwner> Should => new FieldVerificationProvider<T, EditableField<T, TOwner>, TOwner>(this);

        /// <summary>
        /// Gets the expectation verification provider that has a set of verification extension methods.
        /// </summary>
        public new FieldVerificationProvider<T, EditableField<T, TOwner>, TOwner> ExpectTo => Should.Using<ExpectationVerificationStrategy>();

        /// <summary>
        /// Gets the waiting verification provider that has a set of verification extension methods.
        /// Uses <see cref="AtataContext.WaitingTimeout"/> and <see cref="AtataContext.WaitingRetryInterval"/> of <see cref="AtataContext.Current"/> for timeout and retry interval.
        /// </summary>
        public new FieldVerificationProvider<T, EditableField<T, TOwner>, TOwner> WaitTo => Should.Using<WaitingVerificationStrategy>();

        protected virtual bool GetIsReadOnly()
        {
            return Attributes.ReadOnly;
        }

        /// <summary>
        /// Converts the value to string for <see cref="SetValue(T)"/> method.
        /// Can use format from <see cref="ValueSetFormatAttribute"/>,
        /// otherwise from <see cref="FormatAttribute"/>.
        /// Can use culture from <see cref="CultureAttribute"/>.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns>The value converted to string.</returns>
        protected virtual string ConvertValueToStringUsingSetFormat(T value)
        {
            string setFormat = Metadata.Get<ValueSetFormatAttribute>()?.Value;

            return setFormat != null
                ? TermResolver.ToString(value, new TermOptions().MergeWith(ValueTermOptions).WithFormat(setFormat))
                : ConvertValueToString(value);
        }

        /// <summary>
        /// Sets the value.
        /// </summary>
        /// <param name="value">The value.</param>
        protected abstract void SetValue(T value);

        /// <summary>
        /// Sets the value.
        /// Also executes <see cref="TriggerEvents.BeforeSet" /> and <see cref="TriggerEvents.AfterSet" /> triggers.
        /// </summary>
        /// <param name="value">The value to set.</param>
        /// <returns>The instance of the owner page object.</returns>
        public TOwner Set(T value)
        {
            ExecuteTriggers(TriggerEvents.BeforeSet);

            Log.ExecuteSection(
                new ValueSetLogSection(this, ConvertValueToString(value)),
                () => SetValue(value));

            ExecuteTriggers(TriggerEvents.AfterSet);

            return Owner;
        }

        /// <summary>
        /// Sets the random value.
        /// For value generation uses randomization attributes, for example:
        /// <see cref="RandomizeStringSettingsAttribute"/>, <see cref="RandomizeNumberSettingsAttribute"/>, <see cref="RandomizeIncludeAttribute"/>, etc.
        /// Also executes <see cref="TriggerEvents.BeforeSet" /> and <see cref="TriggerEvents.AfterSet" /> triggers.
        /// </summary>
        /// <returns>The instance of the owner page object.</returns>
        public TOwner SetRandom()
        {
            T value = GenerateRandomValue();
            return Set(value);
        }

        /// <summary>
        /// Sets the random value and records it to <paramref name="value"/> parameter.
        /// For value generation uses randomization attributes, for example:
        /// <see cref="RandomizeStringSettingsAttribute" />, <see cref="RandomizeNumberSettingsAttribute" />, <see cref="RandomizeIncludeAttribute" />, etc.
        /// Also executes <see cref="TriggerEvents.BeforeSet" /> and <see cref="TriggerEvents.AfterSet" /> triggers.
        /// </summary>
        /// <param name="value">The generated value.</param>
        /// <returns>The instance of the owner page object.</returns>
        public TOwner SetRandom(out T value)
        {
            value = GenerateRandomValue();
            return Set(value);
        }

        /// <summary>
        /// Sets the random value and invokes <paramref name="callback"/>.
        /// For value generation uses randomization attributes, for example:
        /// <see cref="RandomizeStringSettingsAttribute" />, <see cref="RandomizeNumberSettingsAttribute" />, <see cref="RandomizeIncludeAttribute" />, etc.
        /// Also executes <see cref="TriggerEvents.BeforeSet" /> and <see cref="TriggerEvents.AfterSet" /> triggers.
        /// </summary>
        /// <param name="callback">The callback to be invoked after the value is set.</param>
        /// <returns>The instance of the owner page object.</returns>
        public TOwner SetRandom(Action<T> callback)
        {
            T value = GenerateRandomValue();
            Set(value);
            callback?.Invoke(value);
            return Owner;
        }

        /// <summary>
        /// Generates the random value.
        /// </summary>
        /// <returns>The generated value.</returns>
        protected virtual T GenerateRandomValue()
        {
            return ValueRandomizer.GetRandom<T>(Metadata);
        }
    }
}