text:
<?php

/**
 * @file
 * Contains \Drupal\Console\Command\Field\InfoCommand.
*/

namespace Drupal\Console\Command\Field;

use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Console\Core\Command\Command;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\field\FieldConfigInterface;
use Drupal\Console\Core\Style\DrupalStyle;

/**
 * Class InfoCommand.
 */
class InfoCommand extends Command
{
    /**
     * @var EntityTypeManagerInterface
     */
    protected $entityTypeManager;

    /**
     * @var EntityFieldManagerInterface
     */
    protected $entityFieldManager;

    /**
     * InfoCommand constructor.
     *
     * @param EntityTypeManagerInterface  $entityTypeManager
     * @param EntityFieldManagerInterface $entityFieldManager
     */
    public function __construct(
        EntityTypeManagerInterface $entityTypeManager,
        EntityFieldManagerInterface $entityFieldManager
    ) {
        $this->entityTypeManager = $entityTypeManager;
        $this->entityFieldManager = $entityFieldManager;
        parent::__construct();
    }

    /**
     * @{@inheritdoc}
     */
    public function configure()
    {
        $this
            ->setName('field:info')
            ->setDescription($this->trans('commands.field.info.description'))
            ->setHelp($this->trans('commands.field.info.help'))
            ->addOption(
                'detailed',
                null,
                InputOption::VALUE_NONE,
                $this->trans('commands.field.info.options.detailed')
            )
            ->addOption(
                'entity',
                null,
                InputOption::VALUE_OPTIONAL,
                $this->trans('commands.field.info.options.entity')
            )
            ->addOption(
                'bundle',
                null,
                InputOption::VALUE_OPTIONAL,
                $this->trans('commands.field.info.options.bundle')
            )->setAliases(['fii']);
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new DrupalStyle($input, $output);

        // Retrieve whether detailed option has been selected.
        $detailedOutput = $input->getOption('detailed');

        // Retrieve whether an entity type has been specified.
        $entityTypeOption = $input->getOption('entity');

        // Retrieve whether a specific bundle type has been specified.
        $bundleTypeOption = $input->getOption('bundle');

        $entityList = $this->entityTypeManager->getDefinitions();
        $allFields = $this->entityFieldManager->getFieldMap();

        // Set a flag so we can error if a specific entity type selected but not found.
        $entityTypeOptionFound = false;

        // Set a flag so we can error if a specific bundle type selected but not found.
        $bundleTypeOptionFound = false;

        // Let's count the fields found so we can display a message if none found.
        $fieldCounter = 0;

        foreach ($entityList as $entityTypeId => $entityValue) {
            // If the Entity has bundleEntityType set we grab it.
            $bundleEntityType = $entityValue->get('bundle_entity_type');

            // Check to see if the entity has any bundle before continuing.
            if (!empty($bundleEntityType)) {
                $bundleTypes = $this->entityTypeManager
                    ->getStorage($bundleEntityType)->loadMultiple();

                // If a specific entity type has been selected and this is it then we continue else we skip.
                if ((!empty($entityTypeOption) && ($entityTypeOption == $entityTypeId))| empty($entityTypeOption)
                ) {
                    // Store the fact that we found the entity type specified so we can error if not found.
                    $entityTypeOptionFound = true;

                    // Get the entity type label.
                    $bundleParent = $entityValue->get('label');

                    // Using counter to know whether to output header.
                    $bundleTypeCounter = 0;
                    foreach ($bundleTypes as $bundleType) {
                        // If a specific bundle type has been selected and this is it then we continue else we skip.
                        if ((!empty($bundleTypeOption) && ($bundleTypeOption == $bundleType->id()))| empty($bundleTypeOption)
                        ) {
                            // Store the fact that we found the bundle type specified so we can error if not found.
                            $bundleTypeOptionFound = true;

                            // Increase the bundle type counter so we know whether to output header.
                            $bundleTypeCounter++;

                            if ($bundleTypeCounter == 1) {
                                // Output the Parent Entity label if we haven't already.
                                if ($detailedOutput) {
                                    // If detailed output then display the id as well.
                                    $io->info(strtoupper($bundleParent) . ' (' . $entityTypeId . '):');
                                } else {
                                    // otherwise just display the label for normal output.
                                    $io->info(strtoupper($bundleParent . ':'));
                                }
                                $io->newLine();
                            }

                            // Load in the entityType fields.
                            $fields = $this->getBundleFields(
                                $entityTypeId,
                                $bundleType->id()
                            );

                            foreach ($fields as $field => $fieldArray) {
                                // We found a field so increase the field counter.
                                $fieldCounter++;

                                // Get the related / used in bundles from the field.
                                $relatedBundles = "";
                                $relatedBundlesArray = $allFields[$entityTypeId][$field]['bundles'];

                                // Turn those related / used in bundles array into a string.
                                foreach ($relatedBundlesArray as $relatedBundlesValue) {
                                    if ($bundleTypes[$relatedBundlesValue]->id() != $bundleType->id()) {
                                        if (!empty($relatedBundles)) {
                                            $relatedBundles .= ', ' . $bundleTypes[$relatedBundlesValue]->label();
                                        } else {
                                            $relatedBundles = $bundleTypes[$relatedBundlesValue]->label();
                                        }
                                    }
                                }

                                // Build out our table for the fields.
                                $tableRows[] = $detailedOutput ? [
                                    $fieldArray->get('label'),
                                    $fieldArray->get('field_type'),
                                    $fieldArray->get('description'),
                                    $relatedBundles
                                ] : [
                                    $fieldArray->get('label'),
                                    $fieldArray->get('field_type'),
                                    $relatedBundles
                                ];

                                // Clear the related bundles ready for the next field.
                                unset($relatedBundles);
                            }

                            // If detailed output then display bundle id and description.
                            if ($detailedOutput) {
                                // Output the bundle label and id.
                                $io->info($bundleType->label() . ' (' . $bundleType->id() . ')');
                                $io->info(strip_tags($bundleType->get('description')));
                            } else {
                                // Else just output the bundle label.
                                $io->info($bundleType->label());
                            }

                            // Fill out our table header.
                            // If no rows exist for the fields then we display a no results message.
                            if (!empty($tableRows)) {
                                $tableHeader = $detailedOutput ? [
                                    $this->trans('commands.field.info.table.header-name'),
                                    $this->trans('commands.field.info.table.header-type'),
                                    $this->trans('commands.field.info.table.header-desc'),
                                    $this->trans('commands.field.info.table.header-usage')
                                ] : [
                                    $this->trans('commands.field.info.table.header-name'),
                                    $this->trans('commands.field.info.table.header-type'),
                                    $this->trans('commands.field.info.table.header-usage')
                                ];
                                $io->table($tableHeader, $tableRows);
                            } else {
                                $io->comment(
                                    $this->trans('commands.field.info.messages.fields-none')
                                    . ' ' . $this->trans('commands.field.info.messages.in-bundle-type')
                                    . " '" . $bundleType->label() . "'"
                                );
                            }

                            // Clear out the rows & headers arrays to start fresh.
                            unset($tableHeader, $tableRows);

                            // Create some space so the output looks nice.
                            $io->newLine();
                        }
                    }
                }
            }
        }

        // If entity type was specified but not found then display error message.
        if (!empty($entityTypeOption)) {
            if (!$entityTypeOptionFound) {
                $io->comment(
                    $this->trans('commands.field.info.messages.entity-type') .
                    ' ' . $entityTypeOption . ' ' .
                    $this->trans('commands.field.info.messages.not-found')
                );
            } elseif (!empty($bundleTypeOption) && !$bundleTypeOptionFound) {
                // If specified entity type found and bundle type specified but not found then display error message.
                $io->comment(
                    $this->trans('commands.field.info.messages.bundle-type') .
                    ' ' . $bundleTypeOption . ' ' .
                    $this->trans('commands.field.info.messages.not-found') .
                    ' ' . $this->trans('commands.field.info.messages.in-entity-type') .
                    ' ' . $entityTypeOption
                );
            }
        } elseif (!empty($bundleTypeOption) && !$bundleTypeOptionFound) {
            // If specified bundle type not found then display error message.
            $io->comment(
                $this->trans('commands.field.info.messages.bundle-type') .
                ' ' . $bundleTypeOption . ' ' .
                $this->trans('commands.field.info.messages.not-found')
            );
        } elseif ($fieldCounter == 0) {
            // If no fields found then display appropriate message.
            $io->comment($this->trans('commands.field.info.messages.fields-none'));
        }

        return 0;
    }

    /**
     * Helper function to get the field definitions.
     *
     * @param  string $entityTypeId
     *     The entity type we want to inspect.
     * @param  string $bundle
     *     The bundle we want to discover the fields of.
     * @return array
     *     An array of field storage definitions for the entity type,
     *     keyed by field name.
     */
    private function getBundleFields($entityTypeId, $bundle)
    {
        $fields = [];
        if (!empty($entityTypeId) && !empty($bundle)) {
            $fields = array_filter(
                $this->entityFieldManager->getFieldDefinitions($entityTypeId, $bundle),
                function ($fieldDefinition) {
                    return $fieldDefinition instanceof FieldConfigInterface;
                }
            );
        }

        return $fields;
    }
}


text:
=begin
##########################################################################
#
#  INFIVERVE TECHNOLOGIES PTE LIMITED CONFIDENTIAL
#  __________________
#
#  (C) INFIVERVE TECHNOLOGIES PTE LIMITED, SINGAPORE
#  All Rights Reserved.
#  Product / Project: Flint IT Automation Platform
#  NOTICE:  All information contained herein is, and remains
#  the property of INFIVERVE TECHNOLOGIES PTE LIMITED.
#  The intellectual and technical concepts contained
#  herein are proprietary to INFIVERVE TECHNOLOGIES PTE LIMITED.
#  Dissemination of this information or any form of reproduction of this material
#  is strictly forbidden unless prior written permission is obtained
#  from INFIVERVE TECHNOLOGIES PTE LIMITED, SINGAPORE.
=end

@log.trace("Started executing 'flint-util:ad-winrm:provision_account.rb' flintbit...")
begin

    @first_name = @input.get('first-name')
    @last_name = @input.get('last-name')
    @login_name = @input.get('login-name')
    @initial = @input.get('initial')
    @employee_id = @input.get('emp-id')
    @target = @input.get('target')
  	@username = @input.get('username')
  	@target_password = @input.get('target_password')
    @full_name = "'" + @first_name + ' ' + @last_name + "'"
    @password = "Infiverve@123"
    @user_principal_name = @login_name + '@infiverve.com'
    @command ="Import-module activedirectory;New-ADUser -Name #{@full_name} -GivenName #{@first_name} -Surname #{@last_name} -Initials #{@initial} -SamAccountName #{@login_name} -UserPrincipalName #{@user_principal_name} -EmployeeID #{@employee_id} -AccountPassword (ConvertTo-SecureString -AsPlainText  #{@password}  -Force) -PassThru | ConvertTo-Json"
#secureString = convertto-securestring "Password" -asplaintext -force
    # Call flintbit synchronously and set arguments
flintbit_response = @call.bit('flint-util:ad-winrm:winrm_commonconnect.rb')
                             .set('command', @command)
                             .set("target", @target)
                             .set("username", @username)
                             .set("password", @target_password)
                             .sync

success_message = flintbit_response.message
@result= flintbit_response.get("result")
@error_message= flintbit_response.get("error")
#@newusername = flintbit_response.get("result").get("Name")

if flintbit_response.get("exit-code") == 0
    @log.info("Success in executing WinRM Connector!!!!!!!!!, where exitcode :: #{flintbit_response.get("exit-code")} | message :: #{success_message}  |||| #{flintbit_response.class}")
    @log.info("Command executed :: #{@command} | Command execution results :: #{@result}")
	#if success_message == "success"
	@command = "Import-module activedirectory;Enable-ADAccount #{@login_name}"
	flintbit_response1 = @call.bit('flint-util:ad-winrm:winrm_commonconnect.rb')
		                     .set('command', @command)
                         .set("target", @target)
                         .set("username", @username)
                         .set("password", @target_password)
		                     .sync
		if flintbit_response1.get("exit-code") == 0
			@log.info('Success in executing command of Enable-ADAccount')
			@message_from_enableaction = "Active Directory user account is now enabled"
		  @result = @util.json(@result)
			@name = @result.get('GivenName').to_s
			@surname = @result.get('Surname').to_s
			@userPrincipalName = @result.get('UserPrincipalName').to_s
			@samAccountName = @result.get('SamAccountName').to_s
			@distinguishedName = @result.get('DistinguishedName').to_s
			@fullName = @result.get('Name').to_s
			@objectguid = @result.get('ObjectGuid').to_s
		else
		    @log.error('Error in executing command of Enable-ADAccount')
		    @log.error 'Account provision operation unsuccessful'
		    @message_from_enableaction = "Failed to enable Active Directory user account"
		end
		@command = "Import-module activedirectory;Set-ADUser #{@login_name} -changepasswordatlogon 1"
		flintbit_response1 = @call.bit('flint-util:ad-winrm:winrm_commonconnect.rb')
					     .set('command', @command)
               .set("target", @target)
               .set("username", @username)
               .set("password", @target_password)
					     .sync
		if flintbit_response1.get("exit-code") == 0
		    @log.info('Success in executing command of change password at first login')
		    @message_from_firstlogin = "You can now change the default password at your first login"
		else
		    @log.error('Error in executing command of change password at first login')
		    @message_from_firstlogin = "Please login with default password"
		end
	#else
	#    raise 'Account provision operation unsuccessful'
	#
	#end
    @message_from_provision = "Active directory user account is created successfully"
    @user_message = """ Action details :
* #{@message_from_provision}
* #{@message_from_enableaction}
* #{@message_from_firstlogin}

User Details :
* Name : #{@name}
* Surname : #{@surname}
* User Principal Name : #{@userPrincipalName}
* Enabled : True
* Sam Account Name : #{@samAccountName}
* Distinguished Name : #{@distinguishedName}
* Full Name : #{@fullName}
* ObjectGUID : #{@objectguid} """
@log.info(">>>> #{@user_message} >>>>>>")
    @output.set('result', @result.to_s).set('user_message',@user_message).set('exit-code', 0)
else
@a = @error_message.split(/At line/).first
@user_message = """**Error:**
#{@a.rstrip}"""
@output.set('error', @new_error_msg).set('exit-code', -1).set('user_message',@user_message)
#raise 'Account provision operation unsuccessful'
end
rescue => e
    @log.error(e.message)
    @user_message = """**Failed to create user account !** """
    @output.set('message', e.message).set('exit-code', -1).set('user_message',@user_message)
    @log.info('output in exception')
    @output.exit(1,e.message)
end
@log.trace("Finished executing 'flint-util:ad-winrm:provision_account.rb' flintbit")

redpajama_set_name: RedPajamaGithub


text:
package org.maltparser.core.feature;

import java.util.ArrayList;
import java.util.Stack;
import java.util.regex.Pattern;

import org.maltparser.core.exception.MaltChainedException;
import org.maltparser.core.feature.function.AddressFunction;
import org.maltparser.core.feature.function.FeatureFunction;
import org.maltparser.core.feature.function.Function;
import org.maltparser.core.feature.spec.SpecificationModel;
import org.maltparser.core.feature.spec.SpecificationSubModel;
import org.maltparser.core.feature.system.FeatureEngine;
import org.maltparser.core.helper.HashMap;

/**
*
*
* @author Johan Hall
*/
public class FeatureModel extends HashMap<String, FeatureVector> {
	public final static long serialVersionUID = 3256444702936019250L;
	private final static Pattern splitPattern = Pattern.compile("\\(|\\)|\\[|\\]|,");
	private final SpecificationModel specModel;
	private final ArrayList<AddressFunction> addressFunctionCache;
	private final ArrayList<FeatureFunction> featureFunctionCache;
	private final FeatureFunction divideFeatureFunction;
	private final FeatureRegistry registry;
	private final FeatureEngine featureEngine;
	private final FeatureVector mainFeatureVector;
	private final ArrayList<Integer> divideFeatureIndexVector;

	public FeatureModel(SpecificationModel _specModel, FeatureRegistry _registry, FeatureEngine _engine, String dataSplitColumn, String dataSplitStructure) throws MaltChainedException {
		this.specModel = _specModel;
		this.registry = _registry;
		this.featureEngine = _engine;
		this.addressFunctionCache = new ArrayList<AddressFunction>();
		this.featureFunctionCache = new ArrayList<FeatureFunction>();
		FeatureVector tmpMainFeatureVector = null;
		for (SpecificationSubModel subModel : specModel) {
			FeatureVector fv = new FeatureVector(this, subModel);
			if (tmpMainFeatureVector == null) {
				if (subModel.getSubModelName().equals("MAIN")) {
					tmpMainFeatureVector = fv;
				} else {
					tmpMainFeatureVector = fv;
					put(subModel.getSubModelName(), fv);
				}
			} else {
				put(subModel.getSubModelName(), fv);
			}
		}
		this.mainFeatureVector = tmpMainFeatureVector;
		if (dataSplitColumn != null && dataSplitColumn.length() > 0 && dataSplitStructure != null && dataSplitStructure.length() > 0) {
			final StringBuilder sb = new StringBuilder();
			sb.append("InputColumn(");
			sb.append(dataSplitColumn);
			sb.append(", ");
			sb.append(dataSplitStructure);
			sb.append(')');
			this.divideFeatureFunction = identifyFeature(sb.toString());
//			this.divideFeatureIndexVectorMap = new HashMap<String,ArrayList<Integer>>();
			this.divideFeatureIndexVector = new ArrayList<Integer>();

			for (int i = 0; i < mainFeatureVector.size(); i++) {
				if (mainFeatureVector.get(i).equals(divideFeatureFunction)) {
					divideFeatureIndexVector.add(i);
				}
			}
			for (SpecificationSubModel subModel : specModel) {
				FeatureVector featureVector = get(subModel.getSubModelName());
				if (featureVector == null) {
					featureVector = mainFeatureVector;
				}
				String divideKeyName = "/"+subModel.getSubModelName();
//				divideFeatureIndexVectorMap.put(divideKeyName, divideFeatureIndexVector);

				FeatureVector divideFeatureVector = (FeatureVector)featureVector.clone();
				for (Integer i : divideFeatureIndexVector) {
					divideFeatureVector.remove(divideFeatureVector.get(i));
				}
				put(divideKeyName,divideFeatureVector);
			}
		} else {
			this.divideFeatureFunction = null;
//			this.divideFeatureIndexVectorMap = null;
			this.divideFeatureIndexVector = null;
		}
	}

	public SpecificationModel getSpecModel() {
		return specModel;
	}

	public FeatureRegistry getRegistry() {
		return registry;
	}

	public FeatureEngine getFeatureEngine() {
		return featureEngine;
	}

	public FeatureVector getMainFeatureVector() {
		return mainFeatureVector;
	}

	public FeatureVector getFeatureVector(String subModelName) {
		return get(subModelName);
	}

	public FeatureVector getFeatureVector(String decisionSymbol, String subModelName) {
		final StringBuilder sb = new StringBuilder();
		if (decisionSymbol.length() > 0) {
			sb.append(decisionSymbol);
			sb.append('.');
		}
		sb.append(subModelName);
		if (containsKey(sb.toString())) {
			return get(sb.toString());
		} else if (containsKey(subModelName)) {
			return get(subModelName);
		}
		return mainFeatureVector;
	}

	public FeatureFunction getDivideFeatureFunction() {
		return divideFeatureFunction;
	}

	public boolean hasDivideFeatureFunction() {
		return divideFeatureFunction != null;
	}

//	public ArrayList<Integer> getDivideFeatureIndexVectorMap(String divideSubModelName) {
//		return divideFeatureIndexVectorMap.get(divideSubModelName);
//	}
//
//	public boolean hasDivideFeatureIndexVectorMap() {
//		return divideFeatureIndexVectorMap != null;
//	}

	public ArrayList<Integer> getDivideFeatureIndexVector() {
		return divideFeatureIndexVector;
	}

	public boolean hasDivideFeatureIndexVector() {
		return divideFeatureIndexVector != null;
	}

	public void update() throws MaltChainedException {
		for (int i = 0, n = addressFunctionCache.size(); i < n; i++) {
			addressFunctionCache.get(i).update();
		}

		for (int i = 0, n = featureFunctionCache.size(); i < n; i++) {
			featureFunctionCache.get(i).update();
		}
	}

	public void update(Object[] arguments) throws MaltChainedException {
		for (int i = 0, n = addressFunctionCache.size(); i < n; i++) {
			addressFunctionCache.get(i).update(arguments);
		}

		for (int i = 0, n = featureFunctionCache.size(); i < n; i++) {
			featureFunctionCache.get(i).update();
		}
	}

	public FeatureFunction identifyFeature(String spec) throws MaltChainedException {
		String[] items =splitPattern.split(spec);
		Stack<Object> objects = new Stack<Object>();
		for (int i = items.length-1; i >= 0; i--) {
			if (items[i].trim().length() != 0) {
				objects.push(items[i].trim());
			}
		}
		identifyFeatureFunction(objects);
		if (objects.size() != 1 || !(objects.peek() instanceof FeatureFunction) || (objects.peek() instanceof AddressFunction)) {
			throw new FeatureException("The feature specification '"+spec+"' were not recognized properly. ");
		}
		return (FeatureFunction)objects.pop();
	}

	protected void identifyFeatureFunction(Stack<Object> objects) throws MaltChainedException {
		Function function = featureEngine.newFunction(objects.peek().toString(), registry);
		if (function != null) {
			objects.pop();
			if (!objects.isEmpty()) {
				identifyFeatureFunction(objects);
			}
			initializeFunction(function, objects);
		} else {
			if (!objects.isEmpty()) {
				Object o = objects.pop();
				if (!objects.isEmpty()) {
					identifyFeatureFunction(objects);
				}
				objects.push(o);
			}
		}
	}

	protected void initializeFunction(Function function, Stack<Object> objects) throws MaltChainedException {
		Class<?>[] paramTypes = function.getParameterTypes();
		Object[] arguments = new Object[paramTypes.length];
		for (int i = 0; i < paramTypes.length; i++) {
			if (paramTypes[i] == java.lang.Integer.class) {
				if (objects.peek() instanceof String) {
					String object = (String)objects.pop();
					try {
						objects.push(Integer.parseInt(object));
					} catch (NumberFormatException e) {
						throw new FeatureException("The function '"+function.getClass()+"' cannot be initialized with argument '"+object+"'" + ", expect an integer value. ", e);
					}
				} else {
					throw new FeatureException("The function '"+function.getClass()+"' cannot be initialized with argument '"+objects.peek()+"'" + ", expect an integer value. ");
				}
			} else if (paramTypes[i] == java.lang.Double.class) {
				if (objects.peek() instanceof String) {
					String object = (String)objects.pop();
					try {
						objects.push(Double.parseDouble(object));
					} catch (NumberFormatException e) {
						throw new FeatureException("The function '"+function.getClass()+"' cannot be initialized with argument '"+object+"'" + ", expect a numeric value. ", e);
					}
				} else {
					throw new FeatureException("The function '"+function.getClass()+"' cannot be initialized with argument '"+objects.peek()+"'" + ", expect a numeric value. ");
				}
			} else if (paramTypes[i] == java.lang.Boolean.class) {
				if (objects.peek() instanceof String) {
					objects.push(Boolean.parseBoolean(((String)objects.pop())));
				} else {
					throw new FeatureException("The function '"+function.getClass()+"' cannot be initialized with argument '"+objects.peek()+"'" + ", expect a boolean value. ");

				}
			}
			if (!paramTypes[i].isInstance(objects.peek())) {
				throw new FeatureException("The function '"+function.getClass()+"' cannot be initialized with argument '"+objects.peek()+"'");
			}
			arguments[i] = objects.pop();
		}
		function.initialize(arguments);
		if (function instanceof AddressFunction) {
			int index = addressFunctionCache.indexOf(function);
			if (index != -1) {
				function = addressFunctionCache.get(index);
			} else {
				addressFunctionCache.add((AddressFunction)function);
			}
		} else if (function instanceof FeatureFunction) {
			int index = featureFunctionCache.indexOf(function);
			if (index != -1) {
				function = featureFunctionCache.get(index);
			} else {
				featureFunctionCache.add((FeatureFunction)function);
			}
		}
		objects.push(function);
	}

	public String toString() {
		return specModel.toString();
	}
}


text:
typedef struct ftl_info ftl_info_t;

typedef struct ftl_config{

    int T;  //physical block count
    int npage; //block size
    double op; //device over-provisioning factor
    int ec_max;
    int nZone;

    int payload_enable;
    int ntier;

    struct{
        int policy;
        int d;
        int trigger;
        }gc;

    int write_policy;

}ftl_config_t;

typedef struct ftl_callback{

    int  (*migrate)           ( ftl_info_t *info, block_t *victim );
}ftl_callback_t;

typedef struct ftl_info{

   //configurations
   ftl_config_t config;

   //callback functions
   ftl_callback_t callback;

   void *priv;

}ftl_info_t;

typedef struct ftl_interface{
   int  (*init)    ( ftl_info_t *info );
   void (*destroy) ( ftl_info_t *info );
   int  (*read)    ( ftl_info_t *info, int lpn, void *buffer );
   int  (*write)   ( ftl_info_t *info, int lpn, void *data );
   void (*dump)    ( ftl_info_t *info );
   void (*reset)   ( ftl_info_t *info, int flash_reset );
}ftl_interface_t;

extern ftl_interface_t *ftl_interface;
extern ftl_callback_t  *ftl_callback;
#endif


text:
package com.example.android.background.utilities;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;

import com.example.android.background.MainActivity;
import com.example.android.background.R;
import com.example.android.background.sync.ReminderTasks;
import com.example.android.background.sync.WaterReminderIntentService;

/**
 * Utility class for creating hydration notifications
 */
public class NotificationUtils {

    /*
     * This notification ID can be used to access our notification after we've displayed it. This
     * can be handy when we need to cancel the notification, or perhaps update it. This number is
     * arbitrary and can be set to whatever you like. 1138 is in no way significant.
     */
    private static final int WATER_REMINDER_NOTIFICATION_ID = 1138;
    /**
     * This pending intent id is used to uniquely reference the pending intent
     */
    private static final int WATER_REMINDER_PENDING_INTENT_ID = 3417;
    /**
     * This notification channel id is used to link notifications to this channel
     */
    private static final String WATER_REMINDER_NOTIFICATION_CHANNEL_ID = "reminder_notification_channel";
    private static final int ACTION_IGNORE_PENDING_INTENT_ID = 3;
    private static final int ACTION_INCREMENT_WATER_PENDING_INTENT_ID = 4;

    //  COMPLETED (1) Create a method to clear all notifications
    public static void clearAllNotifications(Context context) {
        NotificationManager notificationManager =
                (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.cancelAll();
    }

    public static void remindUserBecauseCharging(Context context) {
        NotificationManager notificationManager = (NotificationManager)
                context.getSystemService(Context.NOTIFICATION_SERVICE);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            NotificationChannel mChannel = new NotificationChannel(
                    WATER_REMINDER_NOTIFICATION_CHANNEL_ID,
                    context.getString(R.string.main_notification_channel_name),
                    NotificationManager.IMPORTANCE_HIGH);
            notificationManager.createNotificationChannel(mChannel);
            }
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context,WATER_REMINDER_NOTIFICATION_CHANNEL_ID)
                .setColor(ContextCompat.getColor(context, R.color.colorPrimary))
                .setSmallIcon(R.drawable.ic_drink_notification)
                .setLargeIcon(largeIcon(context))
                .setContentTitle(context.getString(R.string.charging_reminder_notification_title))
                .setContentText(context.getString(R.string.charging_reminder_notification_body))
                .setStyle(new NotificationCompat.BigTextStyle().bigText(
                        context.getString(R.string.charging_reminder_notification_body)))
                .setDefaults(Notification.DEFAULT_VIBRATE)
                .setContentIntent(contentIntent(context))
                // COMPLETED (17) Add the two new actions using the addAction method and your helper methods
                .addAction(drinkWaterAction(context))
                .addAction(ignoreReminderAction(context))
                .setAutoCancel(true);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
                && Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
            notificationBuilder.setPriority(NotificationCompat.PRIORITY_HIGH);
        }
        notificationManager.notify(WATER_REMINDER_NOTIFICATION_ID, notificationBuilder.build());
    }

    //  COMPLETED (5) Add a static method called ignoreReminderAction
    public static NotificationCompat.Action ignoreReminderAction(Context context) {
        //      COMPLETED (6) Create an Intent to launch WaterReminderIntentService
        Intent ignoreReminderIntent = new Intent(context, WaterReminderIntentService.class);

        //      COMPLETED (7) Set the action of the intent to designate you want to dismiss the notification
        ignoreReminderIntent.setAction(ReminderTasks.ACTION_DISMISS_NOTIFICATION);

        //      COMPLETED (8) Create a PendingIntent from the intent to launch WaterReminderIntentService
        PendingIntent ignoreReminderPendingIntent = PendingIntent.getService(
                context
                ,ACTION_IGNORE_PENDING_INTENT_ID
                ,ignoreReminderIntent
                ,PendingIntent.FLAG_UPDATE_CURRENT
        );

        //      COMPLETED (9) Create an Action for the user to ignore the notification (and dismiss it)
        NotificationCompat.Action ignoreReminderAction = new NotificationCompat.Action(
                R.drawable.ic_cancel_black_24px,"No, thanks.", ignoreReminderPendingIntent);

        //      COMPLETED (10) Return the action
        return ignoreReminderAction;
    }

    //  COMPLETED (11) Add a static method called drinkWaterAction
    public  static NotificationCompat.Action drinkWaterAction(Context context) {
        //      COMPLETED (12) Create an Intent to launch WaterReminderIntentService
        Intent incrementWaterCountIntent = new Intent(context, WaterReminderIntentService.class);

        //      COMPLETED (13) Set the action of the intent to designate you want to increment the water count
        incrementWaterCountIntent.setAction(ReminderTasks.ACTION_INCREMENT_WATER_COUNT);

        //      COMPLETED (14) Create a PendingIntent from the intent to launch WaterReminderIntentService
        PendingIntent incrementWaterPendingIntent = PendingIntent.getService(
                context
                ,ACTION_INCREMENT_WATER_PENDING_INTENT_ID
                ,incrementWaterCountIntent
                ,PendingIntent.FLAG_UPDATE_CURRENT
        );

        //      COMPLETED (15) Create an Action for the user to tell us they've had a glass of water
        NotificationCompat.Action drinkWaterAction = new NotificationCompat.Action(
                R.drawable.ic_local_drink_black_24px, "I did it!", incrementWaterPendingIntent);

        //      COMPLETED (16) Return the action
        return drinkWaterAction;
    }

    private static PendingIntent contentIntent(Context context) {
        Intent startActivityIntent = new Intent(context, MainActivity.class);

        return PendingIntent.getActivity(
                context,
                WATER_REMINDER_PENDING_INTENT_ID,
                startActivityIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
    }

    private static Bitmap largeIcon(Context context) {
        Resources res = context.getResources();
        Bitmap largeIcon = BitmapFactory.decodeResource(res, R.drawable.ic_local_drink_black_24px);
        return largeIcon;
    }
}


text:
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.voidestate;

public final class Manifest {
    public static final class permission {
        public static final String MAPS_RECEIVE="info.androidhive.googlemapsv2.permission.MAPS_RECEIVE";
    }
}


text:
package com.detorresrc.mifarecard;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;

import com.detorresrc.main.Util;
import com.detorresrc.mifare.IMifareCard;
import com.detorresrc.mifare.MifareResponseCodes;
import com.detorresrc.mifare.MifareResponseData;
import com.detorresrc.mifare.SecretKeys;
import com.detorresrc.reader.Reader;
import com.detorresrc.reader.ReaderTransmitResponse;

public class MifareClassicBase implements IMifareCard{

	protected int dataSize = 0;

	protected byte[] dataBlockAddress;
	protected byte hashDataBLockAddress;
	protected byte[] trailingBlockAddress;

	protected final byte[] keyA = {
		(byte)0x05, (byte)0x20, (byte)0x84, (byte)0x84, (byte)0x20, (byte)0x05
	};
	protected final byte[] keyB = {
		(byte)0x05, (byte)0x05, (byte)0x20, (byte)0x20, (byte)0x84, (byte)0x84
	};

	protected final byte[] defaultKeyA = {
		(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF
	};
	protected final byte[] defaultKeyB = {
		(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF
	};

	protected String protocol = "T=1";

	protected String cardName = "";

	protected byte numberBytesToReadAndWrite = 0x10; // 16 Bytes

	protected byte endOfText = 0x03;

	protected int bytesPerBlock = 16;

	public String getCardName(){
		return this.cardName;
	}

	public int AuthBlock(
			Reader reader,
			byte blockAddress,
			byte[] key,
			byte keyType
	){
		// Load Authentication Keys to Reader
		byte[] buff = new byte[11];
		buff[0]  = (byte)0xFF; // Class
		buff[1]  = (byte)0x82; // INS
		buff[2]  = (byte)0x00; // P1 - Key Structure
		buff[3]  = (byte)0x00; // P2 - Key Location
		buff[4]  = (byte)0x06; // LC

		if( key.length != 6 ){
			return MifareResponseCodes.MF_INVALID_KEY_SIZE;
		}

		// Data Bytes (6 Bytes)
		buff[5]  = key[0];
		buff[6]  = key[1];
		buff[7]  = key[2];
		buff[8]  = key[3];
		buff[9]  = key[4];
		buff[10] = key[5];

		ReaderTransmitResponse response = reader.Trasmit(buff);
		if( response.reponseCode != MifareResponseCodes.MF_SUCCESS ){
			return response.reponseCode;
		}

		// Check SW1(0x90) and SW2(0x00)
		if( ((byte)response.reponseAPDU.getSW1() == (byte)0x90 && (byte)response.reponseAPDU.getSW2() == (byte)0x00) == false ){
			return MifareResponseCodes.MF_AUTH_SEND_ERROR;
		}

		// Auth Block
		byte[] buffAuthBlock = new byte[10];
		buffAuthBlock[0]  = (byte)0xFF; // Class
		buffAuthBlock[1]  = (byte)0x86; // INS
		buffAuthBlock[2]  = (byte)0x00; // P1
		buffAuthBlock[3]  = (byte)0x00; // P2
		buffAuthBlock[4]  = (byte)0x05; // LC

		// Data Bytes (5 Bytes)
		buffAuthBlock[5]  = (byte)0x01;   // Version 0x01
		buffAuthBlock[6]  = (byte)0x00;
		buffAuthBlock[7]  = blockAddress; // Block Number
		buffAuthBlock[8]  = keyType;      // Key Type 0x60 KEY_A 0x61 KEY_B
		buffAuthBlock[9]  = (byte)0x00;   // Key Location

		ReaderTransmitResponse responseAuth = reader.Trasmit(buffAuthBlock);
		if( responseAuth.reponseCode != MifareResponseCodes.MF_SUCCESS ){
			return responseAuth.reponseCode;
		}

		// Check SW1(0x90) and SW2(0x00)
		if( ((byte)responseAuth.reponseAPDU.getSW1() == (byte)0x90 && (byte)responseAuth.reponseAPDU.getSW2() == (byte)0x00) == false ){
			return MifareResponseCodes.MF_AUTH_ERROR;
		}

		return MifareResponseCodes.MF_SUCCESS;
	}

	public MifareResponseData ReadBlock(
			Reader reader,
			byte blockAddress
	){
		MifareResponseData mifareResponse = new MifareResponseData();
		mifareResponse.ReturnCode = MifareResponseCodes.MF_SUCCESS;

		byte[] buffAPDURead = new byte[5];
		buffAPDURead[0]  = (byte)0xFF;                     // Class
		buffAPDURead[1]  = (byte)0xB0;                     // INS
		buffAPDURead[2]  = (byte)0x00;                     // P1
		buffAPDURead[3]  = blockAddress;                   // P2 - Block Number
		buffAPDURead[4]  = this.numberBytesToReadAndWrite; // LE - Number of Bytes to Read

		ReaderTransmitResponse transmitResponse = reader.Trasmit(buffAPDURead);
		if( transmitResponse.reponseCode != MifareResponseCodes.MF_SUCCESS ){
			mifareResponse.ReturnCode = transmitResponse.reponseCode;
			return mifareResponse;
		}
		if( ((byte)transmitResponse.reponseAPDU.getSW1() == (byte)0x90 && (byte)transmitResponse.reponseAPDU.getSW2() == (byte)0x00) == false ){
			mifareResponse.ReturnCode = MifareResponseCodes.MF_READ_BLOCK_ERROR;
			return mifareResponse;
		}

		byte[] tmp = transmitResponse.reponseAPDU.getBytes();
		mifareResponse.data = new byte[16];

		// Initialize var
		for(int i=0; i<16; i++){
			mifareResponse.data[i]=(byte)0x00;
		}

		// Transfer byte data to response var
		for(int i=0; i<16; i++){
			mifareResponse.data[i]=tmp[i];
		}

		return mifareResponse;
	}

	public int WriteBlock(
			Reader reader,
			byte blockAddress,
			byte[] data
	){

		byte[] buffAPDUWrite = new byte[21];

		buffAPDUWrite[0]  = (byte)0xFF;                     // Class
		buffAPDUWrite[1]  = (byte)0xD6;                     // INS
		buffAPDUWrite[2]  = (byte)0x00;                     // P1
		buffAPDUWrite[3]  = blockAddress;                   // P2 - BLock Address
		buffAPDUWrite[4]  = this.numberBytesToReadAndWrite; // LC - Number of Bytes to Update

		if( data.length > this.numberBytesToReadAndWrite ){
			return MifareResponseCodes.MF_WRITE_INVALID_BUFFER_SIZE;
		}

		for(int i=0; i<16; i++){
			buffAPDUWrite[5+i] = 0x00;
		}
		for( int i=0; i<data.length; i++ ){
			buffAPDUWrite[5+i] = data[i];
		}

		ReaderTransmitResponse transmitResponse = reader.Trasmit(buffAPDUWrite);
		if( transmitResponse.reponseCode != MifareResponseCodes.MF_SUCCESS ){
			return transmitResponse.reponseCode;
		}
		if( ((byte)transmitResponse.reponseAPDU.getSW1() == (byte)0x90 && (byte)transmitResponse.reponseAPDU.getSW2() == (byte)0x00) == false ){
			return MifareResponseCodes.MF_WRITE_BLOCK_ERROR;
		}

		return MifareResponseCodes.MF_SUCCESS;
	}

	public MifareResponseData ReadDataBlocks(Reader reader){
		MifareResponseData responseData = new MifareResponseData();
		responseData.ReturnCode = MifareResponseCodes.MF_SUCCESS;
		responseData.data = new byte[ (this.dataBlockAddress.length*16) ];

		int byteCtr = 0;
		int ret;

		for(int i=0; i<this.dataBlockAddress.length; i++){
			ret = this.AuthBlock(
					reader,
					this.dataBlockAddress[i], this.keyA, (byte)0x60);
			if(ret != MifareResponseCodes.MF_SUCCESS){
				ret = this.AuthBlock(
						reader,
						this.dataBlockAddress[i], this.defaultKeyA, (byte)0x60);
			}
			if(ret != MifareResponseCodes.MF_SUCCESS){
				responseData.ReturnCode = MifareResponseCodes.MF_AUTH_ERROR;
				break;
			}

			MifareResponseData responseBlock = this.ReadBlock(reader, this.dataBlockAddress[i]);
			if( responseBlock.ReturnCode != MifareResponseCodes.MF_SUCCESS){
				responseData.ReturnCode = responseBlock.ReturnCode;
				break;
			}

			for(int ii=0; ii<responseBlock.data.length; ii++){
				responseData.data[byteCtr] = responseBlock.data[ii];
				byteCtr++;
			}
		}

		return responseData;
	}

	@Override
	public MifareResponseData ReadTrailingBlocks(Reader reader){
		MifareResponseData responseData = new MifareResponseData();
		responseData.ReturnCode = MifareResponseCodes.MF_SUCCESS;
		responseData.data = new byte[ (this.trailingBlockAddress.length*16) ];

		int byteCtr = 0;
		int ret;

		for(int i=0; i<this.trailingBlockAddress.length; i++){
			ret = this.AuthBlock(
					reader,
					this.trailingBlockAddress[i], this.keyA, (byte)0x60);
			if(ret != MifareResponseCodes.MF_SUCCESS){
				ret = this.AuthBlock(
						reader,
						this.trailingBlockAddress[i], this.defaultKeyA, (byte)0x60);
			}
			if(ret != MifareResponseCodes.MF_SUCCESS){
				responseData.ReturnCode = MifareResponseCodes.MF_AUTH_ERROR;
				break;
			}

			MifareResponseData responseBlock = this.ReadBlock(reader, this.trailingBlockAddress[i]);
			if( responseBlock.ReturnCode != MifareResponseCodes.MF_SUCCESS){
				responseData.ReturnCode = responseBlock.ReturnCode;
				break;
			}

			for(int ii=0; ii<responseBlock.data.length; ii++){
				responseData.data[byteCtr] = responseBlock.data[ii];
				byteCtr++;
			}
		}

		return responseData;
	}

	public int ResetCard(Reader reader){
		int ret=MifareResponseCodes.MF_SUCCESS;

		for(int i=0; i<this.trailingBlockAddress.length; i++){
			ret = this.AuthBlock(
					reader,
					this.trailingBlockAddress[i], this.keyA, (byte)0x60);
			if(ret != MifareResponseCodes.MF_SUCCESS){
				ret = this.AuthBlock(
						reader,
						this.trailingBlockAddress[i], this.defaultKeyA, (byte)0x60);

				if(ret != MifareResponseCodes.MF_SUCCESS){
					return MifareResponseCodes.MF_AUTH_ERROR;
				}
			}

			MifareResponseData responseBlock = this.ReadBlock(reader, this.trailingBlockAddress[i]);
			if( responseBlock.ReturnCode != MifareResponseCodes.MF_SUCCESS ){
				return MifareResponseCodes.MF_READ_BLOCK_ERROR;
			}
			byte[] bData = new byte[responseBlock.data.length];
			bData = responseBlock.data.clone();

			bData[0] = this.defaultKeyA[0];
			bData[1] = this.defaultKeyA[1];
			bData[2] = this.defaultKeyA[2];
			bData[3] = this.defaultKeyA[3];
			bData[4] = this.defaultKeyA[4];
			bData[5] = this.defaultKeyA[5];

			bData[10] = this.defaultKeyB[0];
			bData[11] = this.defaultKeyB[1];
			bData[12] = this.defaultKeyB[2];
			bData[13] = this.defaultKeyB[3];
			bData[14] = this.defaultKeyB[4];
			bData[15] = this.defaultKeyB[5];

			ret = this.WriteBlock(reader, this.trailingBlockAddress[i], bData);
			if( ret != MifareResponseCodes.MF_SUCCESS ){
				return MifareResponseCodes.MF_WRITE_BLOCK_ERROR;
			}
		}

		ret = this.ResetDataBlocks(reader);

		return ret;
	}

	private int ResetDataBlocks(Reader reader){
		int ret=MifareResponseCodes.MF_SUCCESS;

		for(int i=0; i<this.dataBlockAddress.length; i++){
			ret = this.AuthBlock(
					reader,
					this.dataBlockAddress[i], this.defaultKeyA, (byte)0x60);
			if(ret != MifareResponseCodes.MF_SUCCESS){
				return ret;
			}

			byte[] data = new byte[16];
			for(int ii=0; ii<16; ii++){
				data[ii] = (byte)0x00;
			}
			ret = this.WriteBlock(reader, this.dataBlockAddress[i], data);
			if( ret != MifareResponseCodes.MF_SUCCESS ){
				return ret;
			}
		}

		return ret;
	}

	public int Initialize(Reader reader){
		int ret=MifareResponseCodes.MF_SUCCESS;

		for(int i=0; i<this.trailingBlockAddress.length; i++){
			ret = this.AuthBlock(
					reader,
					this.trailingBlockAddress[i], this.defaultKeyA, (byte)0x60);
			if(ret != MifareResponseCodes.MF_SUCCESS){
				return MifareResponseCodes.MF_AUTH_ERROR;
			}

			MifareResponseData responseBlock = this.ReadBlock(reader, this.trailingBlockAddress[i]);
			if( responseBlock.ReturnCode != MifareResponseCodes.MF_SUCCESS ){
				return MifareResponseCodes.MF_READ_BLOCK_ERROR;
			}
			byte[] bData = new byte[responseBlock.data.length];
			bData = responseBlock.data.clone();

			bData[0] = this.keyA[0];
			bData[1] = this.keyA[1];
			bData[2] = this.keyA[2];
			bData[3] = this.keyA[3];
			bData[4] = this.keyA[4];
			bData[5] = this.keyA[5];

			bData[10] = this.keyB[0];
			bData[11] = this.keyB[1];
			bData[12] = this.keyB[2];
			bData[13] = this.keyB[3];
			bData[14] = this.keyB[4];
			bData[15] = this.keyB[5];

			ret = this.WriteBlock(reader, this.trailingBlockAddress[i], bData);
			if( ret != MifareResponseCodes.MF_SUCCESS ){
				return MifareResponseCodes.MF_WRITE_BLOCK_ERROR;
			}
		}

		ret = this.Write(reader, "-NEW CARD-".getBytes());

		return ret;
	}

	@Override
	public MifareResponseData Read(Reader reader) {
		List<Byte> byteList = new ArrayList<Byte>();

		MifareResponseData responseData = new MifareResponseData();

		responseData.ReturnCode = MifareResponseCodes.MF_SUCCESS;

		int ret;
		boolean breakParentLoop = false;
		for( int i=0; i<this.dataBlockAddress.length; i++ ){

			// Auth Block
			ret = this.AuthBlock(
					reader,
					this.dataBlockAddress[i], this.keyA, (byte)0x60);
			/*
			 if(ret == MifareResponseCodes.MF_AUTH_ERROR){
				ret = this.AuthBlock(
						reader,
						this.dataBlockAddress[i], this.defaultKeyA, (byte)0x60);
			}
			*/
			if(ret == MifareResponseCodes.MF_AUTH_ERROR){
				responseData.ReturnCode = MifareResponseCodes.MF_AUTH_ERROR;
				break;
			}

			// Read Block
			MifareResponseData blockResponseData = this.ReadBlock(reader, this.dataBlockAddress[i]);

			if( blockResponseData.ReturnCode == MifareResponseCodes.MF_SUCCESS ){
				for(int b=0; b<blockResponseData.data.length; b++){
					if(blockResponseData.data[b]==this.endOfText){
						breakParentLoop = true;
						break;
					}
					byteList.add(blockResponseData.data[b]);
				}
			}else{
				responseData.ReturnCode = blockResponseData.ReturnCode;
				break;
			}

			if(breakParentLoop){
				break;
			}
		}//{ for( int i=0; i<this.dataBlockAddress.length; i++ ) }

		if( responseData.ReturnCode == MifareResponseCodes.MF_SUCCESS ){
			responseData.data = new byte[ byteList.size() ];
			for(int i=0;i<byteList.size(); i++){
				responseData.data[i] = byteList.get(i);
			}

			// Check Hash
			MessageDigest md;
			byte[] digest;
			try {

				byte[] dataToHash;
				int dataHashCtr=0;
				MifareResponseData uidResponse = this.GetUID(reader);
				if(uidResponse.ReturnCode == MifareResponseCodes.MF_SUCCESS){
					dataToHash = new byte[ responseData.data.length + uidResponse.data.length + SecretKeys.keys.length ];

					for(int i=0; i<uidResponse.data.length; i++){
						dataToHash[dataHashCtr] = uidResponse.data[i];
						dataHashCtr++;
					}
				}else{
					dataToHash = new byte[ responseData.data.length + SecretKeys.keys.length ];
				}

				for(int i=0; i<SecretKeys.keys.length; i++){
					dataToHash[dataHashCtr] = SecretKeys.keys[i];
					dataHashCtr++;
				}

				for(int i=0; i<responseData.data.length; i++){
					dataToHash[dataHashCtr] = responseData.data[i];
					dataHashCtr++;
				}

				md = MessageDigest.getInstance("MD5");
				digest = md.digest(dataToHash);

				// Get Hash From Hash BLock
				ret = this.AuthBlock(
						reader,
						this.hashDataBLockAddress,
						this.keyA,
						(byte)0x60);
				if(ret != MifareResponseCodes.MF_SUCCESS){
					ret = this.AuthBlock(
							reader,
							this.hashDataBLockAddress,
							this.defaultKeyA,
							(byte)0x60);
				}
				if(ret != MifareResponseCodes.MF_SUCCESS){
					responseData.ReturnCode = MifareResponseCodes.MF_HASH_AUTH_ERROR;
				}else{
					MifareResponseData hashResponseData = this.ReadBlock(reader, this.hashDataBLockAddress);
					if(hashResponseData.ReturnCode == MifareResponseCodes.MF_SUCCESS){
						if( Util.ArrayByteCompare(hashResponseData.data, digest) == false ){
							responseData.ReturnCode = MifareResponseCodes.MF_READ_HASH_MISMATCH;
						}

					}else{
						responseData.ReturnCode = MifareResponseCodes.MF_READ_HASH_DATA_ERROR;
					}
				}

			} catch (NoSuchAlgorithmException e) {
				responseData.ReturnCode = MifareResponseCodes.MF_WRITE_MD5_ERROR;
			}
		}

		return responseData;
	}

	public int Write(
			Reader reader,
			byte[] data
	){
		int ret = MifareResponseCodes.MF_SUCCESS;

		if( data.length > this.dataSize ){
			return MifareResponseCodes.MF_WRITE_INVALID_BUFFER_SIZE;
		}

		MessageDigest md;
		byte[] digest;
		try {

			byte[] dataToHash;
			int dataHashCtr=0;
			MifareResponseData uidResponse = this.GetUID(reader);
			if(uidResponse.ReturnCode == MifareResponseCodes.MF_SUCCESS){
				dataToHash = new byte[ data.length + uidResponse.data.length + SecretKeys.keys.length ];

				for(int i=0; i<uidResponse.data.length; i++){
					dataToHash[dataHashCtr] = uidResponse.data[i];
					dataHashCtr++;
				}
			}else{
				dataToHash = new byte[ data.length + SecretKeys.keys.length ];
			}

			for(int i=0; i<SecretKeys.keys.length; i++){
				dataToHash[dataHashCtr] = SecretKeys.keys[i];
				dataHashCtr++;
			}

			for(int i=0; i<data.length; i++){
				dataToHash[dataHashCtr] = data[i];
				dataHashCtr++;
			}

			md = MessageDigest.getInstance("MD5");
			digest = md.digest(dataToHash);

		} catch (NoSuchAlgorithmException e) {
			return MifareResponseCodes.MF_WRITE_MD5_ERROR;
		}

		byte[] dataToWrite = new byte[data.length+1];
		for(int i=0;i<data.length; i++){
			dataToWrite[i] = data[i];
		}
		dataToWrite[data.length] = this.endOfText;

		int bBlockCtr=0;
		boolean breakParent = false;
		for( int i=0; i<this.dataBlockAddress.length; i++ ){
			byte[] byteBlock = new byte[this.bytesPerBlock];
			for(int a=0; a<this.bytesPerBlock;a++){
				byteBlock[a] = 0x00;
			}
			int byteBlockCtr = 0;
			for(int e=0; e<this.bytesPerBlock; e++){
				if( (bBlockCtr+1) > dataToWrite.length ){
					breakParent = true;
					break;
				}
				byteBlock[e] = dataToWrite[bBlockCtr];
				bBlockCtr++;
				byteBlockCtr++;
			}

			if(byteBlockCtr>0){
				// Auth Block
				ret = this.AuthBlock(
						reader,
						this.dataBlockAddress[i], this.keyA, (byte)0x60);
				/*
				if(ret != MifareResponseCodes.MF_SUCCESS){
					ret = this.AuthBlock(
							reader,
							this.dataBlockAddress[i], this.defaultKeyA, (byte)0x60);
				}
				 */
				if(ret != MifareResponseCodes.MF_SUCCESS){
					return MifareResponseCodes.MF_AUTH_ERROR;
				}

				ret = this.WriteBlock(
						reader,
						this.dataBlockAddress[i],
						byteBlock
				);

				if( ret != MifareResponseCodes.MF_SUCCESS ){
					return ret;
				}
			}// { if(byteBlockCtr>0) }

			if(breakParent){
				break;
			}
		}//{ for( int i=0; i<this.dataBlockAddress.length; i++ ) }

		if( ret == MifareResponseCodes.MF_SUCCESS ){
			// Auth Block
			ret = this.AuthBlock(
					reader,
					this.hashDataBLockAddress, this.keyA, (byte)0x60);
			if(ret != MifareResponseCodes.MF_SUCCESS){
				ret = this.AuthBlock(
						reader,
						this.hashDataBLockAddress, this.defaultKeyA, (byte)0x60);
			}
			if(ret != MifareResponseCodes.MF_SUCCESS){
				return MifareResponseCodes.MF_HASH_AUTH_ERROR;
			}

			// Write Hash
			ret = this.WriteBlock(
					reader,
					this.hashDataBLockAddress,
					digest
			);
			if(ret != MifareResponseCodes.MF_SUCCESS){
				return MifareResponseCodes.MF_HASH_WRITE_ERROR;
			}
		}

		return ret;
	}

	@Override
	public byte[] GetDefaultKeyA() {
		return this.defaultKeyA;
	}

	@Override
	public byte[] GetDefaultKeyB() {
		return this.defaultKeyB;
	}

	@Override
	public byte[] GetKeyA() {
		return this.keyA;
	}

	@Override
	public byte[] GetKeyB() {
		return this.keyB;
	}

	@Override
	public byte[] GetTrailingBlockAddress() {
		return this.trailingBlockAddress;
	}

	@Override
	public byte[] GetDataBlockAddress() {
		return this.dataBlockAddress;
	}

	@Override
	public MifareResponseData GetUID(Reader reader) {
		byte[] buff = new byte[5];
		buff[0]  = (byte)0xFF;
		buff[1]  = (byte)0xCA;
		buff[2]  = (byte)0x00;
		buff[3]  = (byte)0x00;
		buff[4]  = (byte)0x00;

		MifareResponseData responseData = new MifareResponseData();

		ReaderTransmitResponse response = reader.Trasmit(buff);
		if( response.reponseCode != MifareResponseCodes.MF_SUCCESS ){
			responseData.ReturnCode = response.reponseCode;
			return responseData;
		}

		if( ((byte)response.reponseAPDU.getSW1() == (byte)0x90 && (byte)response.reponseAPDU.getSW2() == (byte)0x00) ){
			responseData.ReturnCode = MifareResponseCodes.MF_SUCCESS;
			responseData.data = response.reponseAPDU.getData();
		}else if( ((byte)response.reponseAPDU.getSW1() == (byte)0x63 && (byte)response.reponseAPDU.getSW2() == (byte)0x00) ){
			responseData.ReturnCode = MifareResponseCodes.MF_READ_UID_ERROR;
		}else if( ((byte)response.reponseAPDU.getSW1() == (byte)0x6A && (byte)response.reponseAPDU.getSW2() == (byte)0x81) ){
			responseData.ReturnCode = MifareResponseCodes.MF_READ_UID_NOT_SUPPORTED;
		}

		return responseData;
	}

}


text:
# Set an output prefix, which is the local directory if not specified
PREFIX?=$(shell pwd)

# Used to populate version variable in main package.
VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always)

# Allow turning off function inlining and variable registerization
ifeq (${DISABLE_OPTIMIZATION},true)
	GO_GCFLAGS=-gcflags "-N -l"
	VERSION:="$(VERSION)-noopt"
endif

GO_LDFLAGS=-ldflags "-X `go list ./version`.Version=$(VERSION)"

.PHONY: clean all fmt vet lint build test binaries
.DEFAULT: all
all: fmt vet lint build test binaries

AUTHORS: .mailmap .git/HEAD
	 git log --format='%aN <%aE>' | sort -fu > $@

# This only needs to be generated by hand when cutting full releases.
version/version.go:
	./version/version.sh > $@

# Required for go 1.5 to build
GO15VENDOREXPERIMENT := 1

# Package list
PKGS := $(shell go list -tags "${DOCKER_BUILDTAGS}" ./... | grep -v ^github.com/docker/distribution/vendor/)

# Resolving binary dependencies for specific targets
GOLINT := $(shell which golint || echo '')
GODEP := $(shell which godep || echo '')

${PREFIX}/bin/registry: $(wildcard **/*.go)
	@echo "+ $@"
	@go build -tags "${DOCKER_BUILDTAGS}" -o $@ ${GO_LDFLAGS}  ${GO_GCFLAGS} ./cmd/registry

${PREFIX}/bin/digest:  $(wildcard **/*.go)
	@echo "+ $@"
	@go build -tags "${DOCKER_BUILDTAGS}" -o $@ ${GO_LDFLAGS}  ${GO_GCFLAGS} ./cmd/digest

${PREFIX}/bin/registry-api-descriptor-template: $(wildcard **/*.go)
	@echo "+ $@"
	@go build -o $@ ${GO_LDFLAGS} ${GO_GCFLAGS} ./cmd/registry-api-descriptor-template

docs/spec/api.md: docs/spec/api.md.tmpl ${PREFIX}/bin/registry-api-descriptor-template
	./bin/registry-api-descriptor-template $< > $@

vet:
	@echo "+ $@"
	@go vet -tags "${DOCKER_BUILDTAGS}" $(PKGS)

fmt:
	@echo "+ $@"
	@test -z "$$(gofmt -s -l . 2>&1 | grep -v ^vendor/ | tee /dev/stderr)" || \
		(echo >&2 "+ please format Go code with 'gofmt -s'" && false)

lint:
	@echo "+ $@"
	$(if $(GOLINT), , \
		$(error Please install golint: `go get -u github.com/golang/lint/golint`))
	@test -z "$$($(GOLINT) ./... 2>&1 | grep -v ^vendor/ | tee /dev/stderr)"

build:
	@echo "+ $@"
	@go build -tags "${DOCKER_BUILDTAGS}" -v ${GO_LDFLAGS} $(PKGS)

test:
	@echo "+ $@"
	@go test -test.short -tags "${DOCKER_BUILDTAGS}" $(PKGS)

test-full:
	@echo "+ $@"
	@go test -tags "${DOCKER_BUILDTAGS}" $(PKGS)

binaries: ${PREFIX}/bin/registry ${PREFIX}/bin/digest ${PREFIX}/bin/registry-api-descriptor-template
	@echo "+ $@"

clean:
	@echo "+ $@"
	@rm -rf "${PREFIX}/bin/registry" "${PREFIX}/bin/digest" "${PREFIX}/bin/registry-api-descriptor-template"

dep-save:
	@echo "+ $@"
	$(if $(GODEP), , \
		$(error Please install godep: go get github.com/tools/godep))
	@$(GODEP) save $(PKGS)

dep-restore:
	@echo "+ $@"
	$(if $(GODEP), , \
		$(error Please install godep: go get github.com/tools/godep))
	@$(GODEP) restore -v

dep-validate: dep-restore
	@echo "+ $@"
	@rm -Rf .vendor.bak
	@mv vendor .vendor.bak
	@rm -Rf Godeps
	@$(GODEP) save ./...
	@test -z "$$(diff -r vendor .vendor.bak 2>&1 | tee /dev/stderr)" || \
		(echo >&2 "+ borked dependencies! what you have in Godeps/Godeps.json does not match with what you have in vendor" && false)
	@rm -Rf .vendor.bak


text:
package com.chrisrenke.fixedspans;

import android.text.Editable;
import android.text.TextWatcher;
import android.widget.TextView;

import static com.chrisrenke.fixedspans.JustifySpan.Mode;
import static com.chrisrenke.fixedspans.JustifySpan.Mode.ALL_CHARACTERS;
import static com.chrisrenke.fixedspans.JustifySpan.Mode.WHITESPACE_ONLY;
import static com.chrisrenke.fixedspans.JustifySpan.justify;

public class JustifyingTextWatcher implements TextWatcher {

  public static JustifyingTextWatcher buildJustifier(TextView view, boolean justifyLastLine,
      float whitespaceWeight) {
    return new JustifyingTextWatcher(view, justifyLastLine, whitespaceWeight, ALL_CHARACTERS);
  }

  public static JustifyingTextWatcher buildJustifier(TextView view, boolean justifyLastLine) {
    return new JustifyingTextWatcher(view, justifyLastLine, -1f, WHITESPACE_ONLY);
  }

  private final TextView view;
  private final float whitespaceWeight;
  private final boolean justifyLastLine;
  private final Mode mode;

  private boolean ignoreNextPass;

  private JustifyingTextWatcher(TextView view, boolean justifyLastLine, float whitespaceWeight,
      Mode mode) {
    this.view = view;
    this.whitespaceWeight = whitespaceWeight;
    this.justifyLastLine = justifyLastLine;
    this.mode = mode;
  }

  @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  }

  @Override public void onTextChanged(CharSequence s, int start, int before, int count) {
  }

  @Override public void afterTextChanged(Editable s) {
    if (ignoreNextPass || s.toString().length() == 0) {
      ignoreNextPass = false;
      return;
    }
    ignoreNextPass = true;
    justify(view, justifyLastLine, whitespaceWeight, mode);
  }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.orc.stream;

import io.airlift.slice.FixedLengthSliceInput;
import io.airlift.slice.Slice;
import io.airlift.slice.Slices;
import io.prestosql.memory.context.AggregatedMemoryContext;
import io.prestosql.memory.context.LocalMemoryContext;
import io.prestosql.orc.OrcCorruptionException;
import io.prestosql.orc.OrcDataSourceId;
import io.prestosql.orc.OrcDecompressor;

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Optional;

import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
import static io.airlift.slice.Slices.EMPTY_SLICE;
import static io.prestosql.orc.checkpoint.InputStreamCheckpoint.createInputStreamCheckpoint;
import static io.prestosql.orc.checkpoint.InputStreamCheckpoint.decodeCompressedBlockOffset;
import static io.prestosql.orc.checkpoint.InputStreamCheckpoint.decodeDecompressedOffset;
import static java.lang.Math.toIntExact;
import static java.util.Objects.requireNonNull;
import static sun.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET;

public final class OrcInputStream
        extends InputStream
{
    private final OrcDataSourceId orcDataSourceId;
    private final FixedLengthSliceInput compressedSliceInput;
    private final Optional<OrcDecompressor> decompressor;

    private int currentCompressedBlockOffset;
    private FixedLengthSliceInput current;

    private byte[] buffer;
    private final LocalMemoryContext bufferMemoryUsage;

    public OrcInputStream(
            OrcDataSourceId orcDataSourceId,
            FixedLengthSliceInput sliceInput,
            Optional<OrcDecompressor> decompressor,
            AggregatedMemoryContext systemMemoryContext,
            long sliceInputRetainedSizeInBytes)
    {
        this.orcDataSourceId = requireNonNull(orcDataSourceId, "orcDataSource is null");

        requireNonNull(sliceInput, "sliceInput is null");

        this.decompressor = requireNonNull(decompressor, "decompressor is null");

        // memory reserved in the systemMemoryContext is never release and instead it is
        // expected that the context itself will be destroyed at the end of the read
        requireNonNull(systemMemoryContext, "systemMemoryContext is null");
        this.bufferMemoryUsage = systemMemoryContext.newLocalMemoryContext(OrcInputStream.class.getSimpleName());
        checkArgument(sliceInputRetainedSizeInBytes >= 0, "sliceInputRetainedSizeInBytes is negative");
        systemMemoryContext.newLocalMemoryContext(OrcInputStream.class.getSimpleName()).setBytes(sliceInputRetainedSizeInBytes);

        if (!decompressor.isPresent()) {
            this.current = sliceInput;
            this.compressedSliceInput = EMPTY_SLICE.getInput();
        }
        else {
            this.compressedSliceInput = sliceInput;
            this.current = EMPTY_SLICE.getInput();
        }
    }

    @Override
    public void close()
    {
        // close is never called, so do not add code here
    }

    @Override
    public int available()
    {
        if (current == null) {
            return 0;
        }
        return current.available();
    }

    @Override
    public boolean markSupported()
    {
        return false;
    }

    @Override
    public int read()
            throws IOException
    {
        if (current == null) {
            return -1;
        }

        int result = current.read();
        if (result != -1) {
            return result;
        }

        advance();
        return read();
    }

    @Override
    public int read(byte[] b, int off, int length)
            throws IOException
    {
        if (current == null) {
            return -1;
        }

        if (current.remaining() == 0) {
            advance();
            if (current == null) {
                return -1;
            }
        }

        return current.read(b, off, length);
    }

    public void skipFully(long length)
            throws IOException
    {
        while (length > 0) {
            long result = skip(length);
            if (result < 0) {
                throw new OrcCorruptionException(orcDataSourceId, "Unexpected end of stream");
            }
            length -= result;
        }
    }

    public void readFully(byte[] buffer, int offset, int length)
            throws IOException
    {
        while (offset < length) {
            int result = read(buffer, offset, length - offset);
            if (result < 0) {
                throw new OrcCorruptionException(orcDataSourceId, "Unexpected end of stream");
            }
            offset += result;
        }
    }

    public OrcDataSourceId getOrcDataSourceId()
    {
        return orcDataSourceId;
    }

    public long getCheckpoint()
    {
        // if the decompressed buffer is empty, return a checkpoint starting at the next block
        if (current == null || (current.position() == 0 && current.remaining() == 0)) {
            return createInputStreamCheckpoint(toIntExact(compressedSliceInput.position()), 0);
        }
        // otherwise return a checkpoint at the last compressed block read and the current position in the buffer
        return createInputStreamCheckpoint(currentCompressedBlockOffset, toIntExact(current.position()));
    }

    public boolean seekToCheckpoint(long checkpoint)
            throws IOException
    {
        int compressedBlockOffset = decodeCompressedBlockOffset(checkpoint);
        int decompressedOffset = decodeDecompressedOffset(checkpoint);
        boolean discardedBuffer;
        if (compressedBlockOffset != currentCompressedBlockOffset) {
            if (!decompressor.isPresent()) {
                throw new OrcCorruptionException(orcDataSourceId, "Reset stream has a compressed block offset but stream is not compressed");
            }
            compressedSliceInput.setPosition(compressedBlockOffset);
            current = EMPTY_SLICE.getInput();
            discardedBuffer = true;
        }
        else {
            discardedBuffer = false;
        }

        if (decompressedOffset != current.position()) {
            current.setPosition(0);
            if (current.remaining() < decompressedOffset) {
                decompressedOffset -= current.remaining();
                advance();
            }
            current.setPosition(decompressedOffset);
        }
        return discardedBuffer;
    }

    @Override
    public long skip(long n)
            throws IOException
    {
        if (current == null || n <= 0) {
            return -1;
        }

        long result = current.skip(n);
        if (result != 0) {
            return result;
        }
        if (read() == -1) {
            return 0;
        }
        return 1 + current.skip(n - 1);
    }

    // This comes from the Apache Hive ORC code
    private void advance()
            throws IOException
    {
        if (compressedSliceInput == null || compressedSliceInput.remaining() == 0) {
            current = null;
            return;
        }

        // 3 byte header
        // NOTE: this must match BLOCK_HEADER_SIZE
        currentCompressedBlockOffset = toIntExact(compressedSliceInput.position());
        int b0 = compressedSliceInput.readUnsignedByte();
        int b1 = compressedSliceInput.readUnsignedByte();
        int b2 = compressedSliceInput.readUnsignedByte();

        boolean isUncompressed = (b0 & 0x01) == 1;
        int chunkLength = (b2 << 15) | (b1 << 7) | (b0 >>> 1);
        if (chunkLength < 0 || chunkLength > compressedSliceInput.remaining()) {
            throw new OrcCorruptionException(orcDataSourceId, "The chunkLength (%s) must not be negative or greater than remaining size (%s)", chunkLength, compressedSliceInput.remaining());
        }

        Slice chunk = compressedSliceInput.readSlice(chunkLength);

        if (isUncompressed) {
            current = chunk.getInput();
        }
        else {
            OrcDecompressor.OutputBuffer output = new OrcDecompressor.OutputBuffer()
            {
                @Override
                public byte[] initialize(int size)
                {
                    if (buffer == null || size > buffer.length) {
                        buffer = new byte[size];
                        bufferMemoryUsage.setBytes(buffer.length);
                    }
                    return buffer;
                }

                @Override
                public byte[] grow(int size)
                {
                    if (size > buffer.length) {
                        buffer = Arrays.copyOfRange(buffer, 0, size);
                        bufferMemoryUsage.setBytes(buffer.length);
                    }
                    return buffer;
                }
            };

            int uncompressedSize = decompressor.get().decompress((byte[]) chunk.getBase(), (int) (chunk.getAddress() - ARRAY_BYTE_BASE_OFFSET), chunk.length(), output);
            current = Slices.wrappedBuffer(buffer, 0, uncompressedSize).getInput();
        }
    }

    @Override
    public String toString()
    {
        return toStringHelper(this)
                .add("source", orcDataSourceId)
                .add("compressedOffset", compressedSliceInput.position())
                .add("uncompressedOffset", current == null ? null : current.position())
                .add("decompressor", decompressor.map(Object::toString).orElse("none"))
                .toString();
    }
}


text:
namespace Food.Food.NutritionGroups
{
    class AminoAcids
    {

    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Interface org.apache.hadoop.net.Node (Hadoop 1.2.1 API)
</TITLE>

<META NAME="date" CONTENT="2013-07-22">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
org.apache.hadoop.net.Node

Packages that use Node

org.apache.hadoop.mapred
A software framework for easily writing applications which process vast
amounts of data (multi-terabyte data-sets) parallelly on large clusters
(thousands of nodes) built of commodity hardware in a reliable, fault-tolerant
manner.

org.apache.hadoop.net
Network-related classes.

Uses of Node in org.apache.hadoop.mapred

Methods in org.apache.hadoop.mapred that return Node

 Node
JobTracker.getNode(String name)

          Return the Node in the network topology that corresponds to the hostname

static Node
JobTracker.getParentNode(Node node,
              int level)

 Node
JobTracker.resolveAndAddToTopology(String name)

Methods in org.apache.hadoop.mapred that return types with arguments of type Node

 Collection<Node>
JobTracker.getNodesAtMaxLevel()

          Returns a collection of nodes at the max level

Methods in org.apache.hadoop.mapred with parameters of type Node

static Node
JobTracker.getParentNode(Node node,
              int level)

Uses of Node in org.apache.hadoop.net

Classes in org.apache.hadoop.net that implement Node

 class
NodeBase

          A base class that implements interface Node

Fields in org.apache.hadoop.net declared as Node

protected  Node
NodeBase.parent

Methods in org.apache.hadoop.net that return Node

 Node
NetworkTopology.chooseRandom(String scope)

          randomly choose one node from scope
 if scope starts with ~, choose one from the all nodes except for the
 ones in scope; otherwise, choose one from scope

 Node
NetworkTopology.getNode(String loc)

          Given a string representation of a node, return its reference

protected  Node
NetworkTopology.getNodeForNetworkLocation(Node node)

          Return a reference to the node given its string representation.

protected  Node
NetworkTopologyWithNodeGroup.getNodeForNetworkLocation(Node node)

 Node
NodeBase.getParent()

          Return this node's parent

 Node
Node.getParent()

          Return this node's parent

Methods in org.apache.hadoop.net that return types with arguments of type Node

 List<Node>
NetworkTopology.getLeaves(String scope)

          return leaves in scope

Methods in org.apache.hadoop.net with parameters of type Node

 void
NetworkTopology.add(Node node)

          Add a leaf node
 Update node counter & rack counter if neccessary

 void
NetworkTopologyWithNodeGroup.add(Node node)

          Add a leaf node
 Update node counter & rack counter if necessary

 boolean
NetworkTopology.contains(Node node)

          Check if the tree contains node node

 int
NetworkTopology.getDistance(Node node1,
            Node node2)

          Return the distance between two nodes
 It is assumed that the distance from one node to its parent is 1
 The distance between two nodes is calculated by summing up their distances
 to their closest common  ancestor.

protected  Node
NetworkTopology.getNodeForNetworkLocation(Node node)

          Return a reference to the node given its string representation.

protected  Node
NetworkTopologyWithNodeGroup.getNodeForNetworkLocation(Node node)

static String
NodeBase.getPath(Node node)

          Return this node's path

 boolean
NetworkTopology.isOnSameNodeGroup(Node node1,
                  Node node2)

          Return false directly as not aware of NodeGroup, to be override in sub-class

 boolean
NetworkTopologyWithNodeGroup.isOnSameNodeGroup(Node node1,
                  Node node2)

          Check if two nodes are on the same node group (hypervisor) The
 assumption here is: each nodes are leaf nodes.

 boolean
NetworkTopology.isOnSameRack(Node node1,
             Node node2)

          Check if two nodes are on the same rack

 boolean
NetworkTopologyWithNodeGroup.isOnSameRack(Node node1,
             Node node2)

protected  boolean
NetworkTopology.isSameParents(Node node1,
              Node node2)

          Compare the parents of each node for equality

 void
NetworkTopology.pseudoSortByDistance(Node reader,
                     Node[] nodes)

          Sort nodes array by their distances to reader
 It linearly scans the array, if a local node is found, swap it with
 the first element of the array.

 void
NetworkTopology.pseudoSortByDistance(Node reader,
                     Node[] nodes)

          Sort nodes array by their distances to reader
 It linearly scans the array, if a local node is found, swap it with
 the first element of the array.

 void
NetworkTopologyWithNodeGroup.pseudoSortByDistance(Node reader,
                     Node[] nodes)

          Sort nodes array by their distances to reader
 It linearly scans the array, if a local node is found, swap it with
 the first element of the array.

 void
NetworkTopologyWithNodeGroup.pseudoSortByDistance(Node reader,
                     Node[] nodes)

          Sort nodes array by their distances to reader
 It linearly scans the array, if a local node is found, swap it with
 the first element of the array.

 void
NetworkTopology.remove(Node node)

          Remove a node
 Update node counter & rack counter if neccessary

 void
NetworkTopologyWithNodeGroup.remove(Node node)

          Remove a node
 Update node counter and rack counter if necessary

 void
NodeBase.setParent(Node parent)

          Set this node's parent

 void
Node.setParent(Node parent)

          Set this node's parent

protected static void
NetworkTopology.swap(Node[] nodes,
     int i,
     int j)

Method parameters in org.apache.hadoop.net with type arguments of type Node

 int
NetworkTopology.countNumOfAvailableNodes(String scope,
                         Collection<Node> excludedNodes)

          return the number of leaves in scope but not in excludedNodes
 if scope starts with ~, return the number of nodes that are not
 in scope and excludedNodes;

Constructors in org.apache.hadoop.net with parameters of type Node

NodeBase(String name,
         String location,
         Node parent,
         int level)

          Construct a node from its name and its location

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2009 The Apache Software Foundation


text:
namespace respend {

WalletNotifier::WalletNotifier() : valid(false), interesting(false)
{
}

bool WalletNotifier::AddOutpointConflict(
        const COutPoint&, const CTxMemPool::txiter,
        const CTransaction& respendTx,
        bool seenBefore, bool isEquivalent)
{
    if (isEquivalent || seenBefore)
        return true; // look at more outpoints

    if (interesting)
        return false; // we already have a copy

    interesting = true;
    this->respendTx = respendTx;

    // we have enough info
    return false;
}

bool WalletNotifier::IsInteresting() const {
    return interesting;
}

void WalletNotifier::SetValid(bool v) {
    valid = v;
}

void WalletNotifier::Trigger() {
    if (!valid || !interesting) {
        return;
    }
    SyncWithWallets(respendTx, nullptr, true);
}

} // ns respend


text:
@interface PodsDummy_SwiftImageBrowser : NSObject
@end
@implementation PodsDummy_SwiftImageBrowser
@end


text:
package org.nd4j.linalg.api.ops.impl.layers.convolution.config;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import org.nd4j.linalg.api.ops.impl.layers.convolution.Pooling2D;

import java.util.LinkedHashMap;
import java.util.Map;

@Builder
@AllArgsConstructor
@Data
public class Pooling2DConfig extends BaseConvolutionConfig {

    private long kh, kw, sy, sx, ph, pw, virtualHeight,virtualWidth;
    /**
     * Extra is an optional parameter mainly for use with pnorm right now.
     * All pooling implementations take 9 parameters save pnorm.
     * Pnorm takes 10 and is cast to an int.
     */
    private double extra;
    private Pooling2D.Pooling2DType type;
    @Builder.Default private Pooling2D.Divisor divisor = Pooling2D.Divisor.EXCLUDE_PADDING;
    private boolean isSameMode;
    @Builder.Default private long dh = 1;
    @Builder.Default private long dw = 1;
    @Builder.Default private boolean isNHWC = false;

    public Map<String,Object> toProperties() {
        Map<String,Object> ret = new LinkedHashMap<>();
        ret.put("kh",kh);
        ret.put("kw",kw);
        ret.put("sy",sy);
        ret.put("sx",sx);
        ret.put("ph",ph);
        ret.put("pw",pw);
        ret.put("virtualHeight",virtualHeight);
        ret.put("virtualWidth",virtualWidth);
        ret.put("extra",extra);
        ret.put("type",type.toString());
        ret.put("isSameMode",isSameMode);
        ret.put("dh",dh);
        ret.put("dw",dw);
        ret.put("isNHWC",isNHWC);
        return ret;
    }

}


text:
package com.streamsets.pipeline.lib.jdbc;

import com.streamsets.pipeline.api.base.BaseEnumChooserValues;

public class JDBCOperationChooserValues extends BaseEnumChooserValues<JDBCOperationType> {

  public JDBCOperationChooserValues() {
    super(JDBCOperationType.class);
  }

}


text:
package org.springframework.messaging.simp.config;

import java.util.ArrayList;
import java.util.Arrays;

import org.junit.Test;

import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.StubMessageChannel;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler;

import static org.junit.Assert.*;

/**
 * Unit tests for {@link org.springframework.messaging.simp.config.StompBrokerRelayRegistration}.
 *
 * @author Rossen Stoyanchev
 */
public class StompBrokerRelayRegistrationTests {

	@Test
	public void test() {

		SubscribableChannel clientInboundChannel = new StubMessageChannel();
		MessageChannel clientOutboundChannel = new StubMessageChannel();
		SubscribableChannel brokerChannel = new StubMessageChannel();

		String[] destinationPrefixes = new String[] { "/foo", "/bar" };

		StompBrokerRelayRegistration registration = new StompBrokerRelayRegistration(
				clientInboundChannel, clientOutboundChannel, destinationPrefixes);

		registration.setClientLogin("clientlogin");
		registration.setClientPasscode("clientpasscode");
		registration.setSystemLogin("syslogin");
		registration.setSystemPasscode("syspasscode");
		registration.setSystemHeartbeatReceiveInterval(123);
		registration.setSystemHeartbeatSendInterval(456);
		registration.setVirtualHost("example.org");

		StompBrokerRelayMessageHandler relayMessageHandler = registration.getMessageHandler(brokerChannel);

		assertEquals(Arrays.asList(destinationPrefixes),
				new ArrayList<String>(relayMessageHandler.getDestinationPrefixes()));

		assertEquals("clientlogin", relayMessageHandler.getClientLogin());
		assertEquals("clientpasscode", relayMessageHandler.getClientPasscode());
		assertEquals("syslogin", relayMessageHandler.getSystemLogin());
		assertEquals("syspasscode", relayMessageHandler.getSystemPasscode());
		assertEquals(123, relayMessageHandler.getSystemHeartbeatReceiveInterval());
		assertEquals(456, relayMessageHandler.getSystemHeartbeatSendInterval());
		assertEquals("example.org", relayMessageHandler.getVirtualHost());
	}

}


text:
/**
    * The MovementSystem updates PositionComponents
    *
    * Author: Skylar Payne
    * Date: 8/3/2013
    * File: MovementSystem.h
**/

#pragma once

#include "IListener.h"
#include "ISystem.h"

class MovementSystem : public ISystem, public IListener<MoveEntityMessage>, public IListener<PushEntityMessage>
{
public:
    MovementSystem() : ISystem("Movement") { }
    void Update(unsigned int dt) override;
    bool ValidateEntity(unsigned int ID) override;

    void OnMessage(MoveEntityMessage& msg) override;
    void OnMessage(PushEntityMessage& msg) override;
};


text:
namespace Interop { namespace FrameServices { namespace DirectShow
{
    public ref class DSDecoderFactory : DecoderFactory
    {
    public:
        virtual FrameDecoder ^ GetDecoder(String^ filename) override sealed
        {
            return gcnew DSDecoder(filename);
        }
    };
} } }


text:
namespace TomsToolbox.Essentials;

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

/// <summary>
/// A <see cref="System.Threading.Tasks.TaskScheduler" /> that queues the tasks an runs them in one dedicated thread.
/// </summary>
public sealed class ThreadBoundTaskScheduler : TaskScheduler, IDisposable
{
    private readonly BlockingCollection<Task> _tasksCollection = new();
    private readonly Thread _thread;

    /// <summary>
    /// Initializes a new instance of the <see cref="ThreadBoundTaskScheduler"/> class.
    /// </summary>
    public ThreadBoundTaskScheduler()
    {
        _thread = new Thread(Execute);
        _thread.Start();

        TaskFactory = new TaskFactory(this);
    }

    /// <summary>
    /// Gets the thread identifier of the underlying thread.
    /// </summary>
    public int ThreadId => _thread.ManagedThreadId;

    /// <summary>
    /// Gets the task factory that can be used to enqueue a new task.
    /// </summary>
    public TaskFactory TaskFactory { get; }

    private void Execute()
    {
        foreach (var task in _tasksCollection.GetConsumingEnumerable())
        {
            TryExecuteTask(task);
        }
    }

    /// <summary>
    /// For debugger support only, generates an enumerable of <see cref="T:System.Threading.Tasks.Task" /> instances currently queued to the scheduler waiting to be executed.
    /// </summary>
    /// <returns>
    /// An enumerable that allows a debugger to traverse the tasks currently queued to this scheduler.
    /// </returns>
    protected override IEnumerable<Task> GetScheduledTasks()
    {
        return _tasksCollection.ToArray();
    }

    /// <summary>
    /// Queues a <see cref="T:System.Threading.Tasks.Task" /> to the scheduler.
    /// </summary>
    /// <param name="task">The <see cref="T:System.Threading.Tasks.Task" /> to be queued.</param>
    protected override void QueueTask(Task task)
    {
        _tasksCollection.Add(task);
    }

    /// <summary>
    /// Determines whether the provided <see cref="T:System.Threading.Tasks.Task" /> can be executed synchronously in this call, and if it can, executes it.
    /// </summary>
    /// <param name="task">The <see cref="T:System.Threading.Tasks.Task" /> to be executed.</param>
    /// <param name="taskWasPreviouslyQueued">A Boolean denoting whether or not task has previously been queued. If this parameter is True, then the task may have been previously queued (scheduled); if False, then the task is known not to have been queued, and this call is being made in order to execute the task inline without queuing it.</param>
    /// <returns>
    /// A Boolean value indicating whether the task was executed inline.
    /// </returns>
    protected override bool TryExecuteTaskInline(Task? task, bool taskWasPreviouslyQueued)
    {
        return false;
    }

    /// <summary>
    /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
    /// </summary>
    public void Dispose()
    {
        _tasksCollection.CompleteAdding();
        _thread.Join();
        _tasksCollection.Dispose();
    }
}


text:
<?php

class HttpServerFixture extends CakeTestFixture {

  // Import schema and records for the model from the default database
  public $import = array('model' => 'HttpServer', 'records' => true);
}


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE401_Memory_Leak__strdup_wchar_t_82a.cpp
Label Definition File: CWE401_Memory_Leak__strdup.label.xml
Template File: sources-sinks-82a.tmpl.cpp
*/
/*
 * @description
 * CWE: 401 Memory Leak
 * BadSource:  Allocate data using wcsdup()
 * GoodSource: Allocate data on the stack
 * Sinks:
 *    GoodSink: call free() on data
 *    BadSink : no deallocation of data
 * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
 *
 * */

#include "std_testcase.h"
#include "CWE401_Memory_Leak__strdup_wchar_t_82.h"

namespace CWE401_Memory_Leak__strdup_wchar_t_82
{

#ifndef OMITBAD

void bad()
{
    wchar_t * data;
    data = NULL;
    {
        wchar_t myString[] = L"myString";
        /* POTENTIAL FLAW: Allocate memory from the heap using a function that requires free() for deallocation */
        data = wcsdup(myString);
        /* Use data */
        printWLine(data);
    }
    CWE401_Memory_Leak__strdup_wchar_t_82_base* baseObject = new CWE401_Memory_Leak__strdup_wchar_t_82_bad;
    baseObject->action(data);
    delete baseObject;
}

#endif /* OMITBAD */

#ifndef OMITGOOD

/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
    wchar_t * data;
    data = NULL;
    /* FIX: Use memory allocated on the stack with ALLOCA */
    data = (wchar_t *)ALLOCA(100*sizeof(wchar_t));
    /* Initialize then use data */
    wcscpy(data, L"a string");
    printWLine(data);
    CWE401_Memory_Leak__strdup_wchar_t_82_base* baseObject = new CWE401_Memory_Leak__strdup_wchar_t_82_goodG2B;
    baseObject->action(data);
    delete baseObject;
}

/* goodB2G uses the BadSource with the GoodSink */
static void goodB2G()
{
    wchar_t * data;
    data = NULL;
    {
        wchar_t myString[] = L"myString";
        /* POTENTIAL FLAW: Allocate memory from the heap using a function that requires free() for deallocation */
        data = wcsdup(myString);
        /* Use data */
        printWLine(data);
    }
    CWE401_Memory_Leak__strdup_wchar_t_82_base* baseObject = new CWE401_Memory_Leak__strdup_wchar_t_82_goodB2G;
    baseObject->action(data);
    delete baseObject;
}

void good()
{
    goodG2B();
    goodB2G();
}

#endif /* OMITGOOD */

} /* close namespace */

/* Below is the main(). It is only used when building this testcase on
   its own for testing or for building a binary to use in testing binary
   analysis tools. It is not used when compiling all the testcases as one
   application, which is how source code analysis tools are tested. */

#ifdef INCLUDEMAIN

using namespace CWE401_Memory_Leak__strdup_wchar_t_82; /* so that we can use good and bad easily */

int main(int argc, char * argv[])
{
    /* seed randomness */
    srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
    printLine("Calling good()...");
    good();
    printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
    printLine("Calling bad()...");
    bad();
    printLine("Finished bad()");
#endif /* OMITBAD */
    return 0;
}

#endif