text:
<!DOCTYPE html>

<html
	ng-app="cinnamon"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	layout:decorator="configuration/layout/default">

<head>
<title>사용자</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<script type="text/javascript" src="/js/configuration/directives/searchList.js"></script>
<script type="text/javascript" src="/js/configuration/directives/dialogTemplate.js"></script>

<script type="text/javascript" src="/js/configuration/users/viewController.js"></script>
<script type="text/javascript" src="/js/configuration/users/listController.js"></script>
<script type="text/javascript" src="/js/configuration/users/createController.js"></script>
<script type="text/javascript" src="/js/configuration/users/modifyController.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
angular.module('cinnamon')
.config(function($stateProvider, $urlRouterProvider) {
	$stateProvider.state('list', {
		url: '/configuration/users',
		templateUrl: '/configuration/partials/users/list',
		controller: 'configuration.users.list'
	}).state('create', {
		url: '/configuration/users/create',
		templateUrl: '/configuration/partials/users/create',
		controller: 'configuration.users.create'
	}).state('view', {
		url: '/configuration/users/:userId',
		templateUrl: '/configuration/partials/users/view',
		controller: 'configuration.users.view'
	}).state('modify', {
		url: '/configuration/users/:userId/modify',
		templateUrl: '/configuration/partials/users/modify',
		controller: 'configuration.users.modify'
	});

	//$urlRouterProvider.otherwise('/configuration/users');
});
/*]]>*/
</script>

<base href="/" />
</head>

<body layout:fragment="content">
	<ui-view layout-fill=""/>
</body>
</html>


text:
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{hyperref}

%opening
\title{Base}
\author{\href{http://www.baudo.hol.es}{giuseppe baudo}}

\begin{document}

\maketitle

\section{DEFINIZIONE}
A basis for a vector space is a sequence of vectors that is linearly independent and that spans the space.

\section{NOTE}
A vector space can have many different bases.

Tutte le basi hanno lo stesso numero di vettori.

\section{ESEMPIO}

\section{APPROFONDIMENTI}
\begin{itemize}
 \item \url{http://joshua.smcvt.edu/linearalgebra/book.pdf}
\end{itemize}

\end{document}

redpajama_set_name: RedPajamaGithub


text:
@interface GGMEx_Model ()

@property (strong) GGMEx_Model *game;

@end

@implementation GGMEx_View

@dynamic game;

#pragma mark - drawing states

- (UIColor *)colorForGameState:(int)stateInt
{
	switch (stateInt) {
		case GGMEx_State_1:
			return [UIColor lightGrayColor];
		case GGMEx_State_2:
			return [UIColor darkGrayColor];
		case GGMEx_State_3:
			return [UIColor redColor];
		case GGMEx_State_4:
			return [UIColor blueColor];
		default:
		case GGMEx_State_none:
			return [UIColor clearColor];
	}
}

- (NSString *)textForGameState:(int)stateInt
{
	int x,y;
	y = stateInt / self.game.gridHeight;
	x = stateInt % self.game.gridWidth;
	return [NSString stringWithFormat:@"{%i,%i}", x, y];
}

- (void)setTextStateForX:(int)x andY:(int)y byAppendingString:(NSString*)stringToAppend
{
	int stateInt = [self.game stateAtX:x andY:y];
	NSString *stateStr = [self textForGameState:stateInt];
	stateStr = [stateStr stringByAppendingString:stringToAppend];
	UILabel *view = (UILabel*)[self viewForX:x andY:y];
	[view setText:stateStr];
}

#pragma mark - detect taps

- (void)handleTapAtX:(int)x andY:(int)y
{
//	GGMEx_State state = (GGMEx_State)[self.game stateAtX:x andY:y];
//	state = (state == GGMEx_State_3) ? GGMEx_State_none : state + 1;
//	[self.game setStateAtX:x andY:y toState:state];
	if (self.gridType == GGM_GRIDTYPE_TEXTLABEL) {
		[self setTextStateForX:x andY:y byAppendingString:@"\ntapped"];
	}
	else {
		[self.game setStateAtX:x andY:y toState:GGMEx_State_3];
		[self refreshViewForX:x andY:y];
	}
}

#pragma mark - detect drags

- (void)handleDragStart
{
	if (self.gridType == GGM_GRIDTYPE_TEXTLABEL) {
		[self setTextStateForX:self.dragX andY:self.dragY byAppendingString:@"\ndrag-started"];
	}
	else {
		[self setStateForDragXY];
	}
}

- (void)handleDragContinue
{
	if (self.gridType == GGM_GRIDTYPE_TEXTLABEL) {
		[self setTextStateForX:self.dragX andY:self.dragY byAppendingString:@"\ndrag-through"];
	}
	else {
		[self setStateForDragXY];
	}
}

- (void)handleDragContinuous
{
	[super handleDragContinuous];
	if (self.gridType == GGM_GRIDTYPE_TEXTLABEL)
	{
		if (self.dragCurrentX != self.dragX ||
			self.dragCurrentY != self.dragY)
		{
			[self setTextStateForX:self.dragCurrentX andY:self.dragCurrentY byAppendingString:@"\ndrag-through"];
		}
	}
	else {
		[self.game setStateAtX:self.dragCurrentX andY:self.dragCurrentY toState:GGMEx_State_4];
		[self refreshViewForX:self.dragCurrentX andY:self.dragCurrentY];
	}
}

- (void)handleDragEnd
{
	if (self.shouldDragContinuous) {
		CGPoint startPoint = [self coordinatePointForPixelPoint:self.dragPointBegan];
		[self refreshViewForX:startPoint.x andY:startPoint.y];
		if (self.gridType == GGM_GRIDTYPE_TEXTLABEL) {
			[self setTextStateForX:startPoint.x andY:startPoint.y byAppendingString:@"\ndrag-started"];
		}
	}
	if (self.gridType == GGM_GRIDTYPE_TEXTLABEL) {
		[self setTextStateForX:self.dragX andY:self.dragY byAppendingString:@"\ndrag-ended"];
	}
	else {
		[self setStateForDragXY];
	}
}

- (void)setStateForDragXY
{
	[self.game setStateAtX:self.dragX andY:self.dragY toState:GGMEx_State_4];
	[self refreshViewForX:self.dragX andY:self.dragY];
}

@end


text:
using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace Gneu
{
	TEST_CLASS(V8FlagsTests)
	{
	public:
		TEST_METHOD(StrictModeFlagOff)
		{
			Flathead fh;
			bool result;

			fh.Execute("(function() { return !this; })();", result);

			Assert::IsFalse(result);
		}

		TEST_METHOD(StrictModeFlagOn)
		{
			Configuration cfg;

			cfg.AlwaysStrict(true);

			Flathead fh(cfg);
			bool result;

			fh.Execute("(function() { return !this; })();", result);

			Assert::IsTrue(result);
		}
	};
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Linq;
using Rxx.Labs.Properties;
using Rxx.Parsers.Linq;

namespace Rxx.Labs.Parsers.Interactive
{
  [DisplayName("XML Schema")]
  [Description("Parses an XML string against a basic XML schema defined as a context-sensitive grammar (CSG).")]
  public sealed class XmlSchemaLab : BaseConsoleLab
  {
    protected override void Main()
    {
      TraceLine(Instructions.WaitForCompletion);

      IEnumerable<char> xml = @"
<root>
	<vehicles>
		<car make=""We Get U There"" model=""Toy"" />
		<plane />
		<boat>
			<!-- Typically found on water -->
		</boat>
	</vehicles>
	<equipment>
		<tire>
			Round things on a car.
		</tire>
		<wing>
			Long things on a plane.
		</wing>
		<sail>
			Tall things on a boat.
		</sail>
	</equipment>
</root>";

      IEnumerable<XElement> parsed = xml.ParseXml(parser =>
        from next in parser
        let elementsWithText = parser.Element(parser.Text).OneOrMore()
        select parser.Element("root",
                parser.Element("vehicles",
                  parser.Element("car", parser.Attribute("model"), parser.Attribute("make")),
                  parser.Element("plane"),
                  parser.Element("boat")),
                parser.Element("equipment",
                  elementsWithText)));

      parsed.ForEach(ConsoleOutput(Environment.NewLine));
    }
  }
}


text:
package org.guvnor.ala.build.maven.model.impl;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

import org.guvnor.ala.build.maven.model.MavenProject;
import org.guvnor.ala.build.maven.model.PlugIn;
import org.guvnor.ala.config.CloneableConfig;
import org.uberfire.java.nio.file.Path;

public class MavenProjectImpl implements MavenProject,
                                         CloneableConfig<MavenProject> {

    private String id;
    private String type;
    private String name;
    private String expectedBinary;
    private Path rootPath;
    private Path path;
    private Path binaryPath;
    private String tempDir;
    private Collection<PlugIn> buildPlugins = Collections.emptyList();

    public MavenProjectImpl() {
    }

    public MavenProjectImpl(final String id,
                            final String type,
                            final String name,
                            final String expectedBinary,
                            final Path rootPath,
                            final Path path,
                            final Path binaryPath,
                            final String tempDir,
                            final Collection<PlugIn> buildPlugins) {
        this.id = id;
        this.type = type;
        this.name = name;
        this.expectedBinary = expectedBinary;
        this.rootPath = rootPath;
        this.path = path;
        this.binaryPath = binaryPath;
        this.tempDir = tempDir;
        if (buildPlugins != null) {
            this.buildPlugins = new ArrayList<>(buildPlugins);
        }
    }

    @Override
    public Collection<PlugIn> getBuildPlugins() {
        return buildPlugins;
    }

    @Override
    public String getId() {
        return id;
    }

    @Override
    public String getType() {
        return type;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getExpectedBinary() {
        return expectedBinary;
    }

    @Override
    public Path getRootPath() {
        return rootPath;
    }

    @Override
    public Path getPath() {
        return path;
    }

    @Override
    public Path getBinaryPath() {
        return binaryPath;
    }

    @Override
    public String getTempDir() {
        return tempDir;
    }

    @Override
    public MavenProject asNewClone(final MavenProject origin) {
        return new MavenProjectImpl(origin.getId(),
                                    origin.getType(),
                                    origin.getName(),
                                    origin.getExpectedBinary(),
                                    origin.getRootPath(),
                                    origin.getPath(),
                                    origin.getBinaryPath(),
                                    origin.getTempDir(),
                                    origin.getBuildPlugins());
    }
}


text:
const int ci_SPARSEINTVECT_VERSION =
    0x0001;  //!< version number to use in pickles
namespace RDKit {
//! a class for efficiently storing sparse vectors of ints
template <typename IndexType>
class SparseIntVect {
 public:
  typedef std::map<IndexType, int> StorageType;

  SparseIntVect() : d_length(0){};

  //! initialize with a particular length
  SparseIntVect(IndexType length) : d_length(length){};

  //! Copy constructor
  SparseIntVect(const SparseIntVect<IndexType> &other) {
    d_length = other.d_length;
    d_data.insert(other.d_data.begin(), other.d_data.end());
  }

  //! constructor from a pickle
  SparseIntVect(const std::string &pkl) {
    initFromText(pkl.c_str(), pkl.size());
  };
  //! constructor from a pickle
  SparseIntVect(const char *pkl, const unsigned int len) {
    initFromText(pkl, len);
  };

  //! destructor (doesn't need to do anything)
  ~SparseIntVect() {}

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"
#elif (defined(__GNUC__) || defined(__GNUG__)) && \
    (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 1))
#if (__GNUC__ > 4 || __GNUC_MINOR__ > 5)
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wtype-limits"
#endif
  //! return the value at an index
  int getVal(IndexType idx) const {
    if (idx < 0 || idx >= d_length) {
      throw IndexErrorException(static_cast<int>(idx));
    }
    int res = 0;
    typename StorageType::const_iterator iter = d_data.find(idx);
    if (iter != d_data.end()) {
      res = iter->second;
    }
    return res;
  };

  //! set the value at an index
  void setVal(IndexType idx, int val) {
    if (idx < 0 || idx >= d_length) {
      throw IndexErrorException(static_cast<int>(idx));
    }
    if (val != 0) {
      d_data[idx] = val;
    } else {
      d_data.erase(idx);
    }
  };
#ifdef __clang__
#pragma clang diagnostic pop
#elif (defined(__GNUC__) || defined(__GNUG__)) && \
    (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5))
#pragma GCC diagnostic pop
#endif
  //! support indexing using []
  int operator[](IndexType idx) const { return getVal(idx); };

  //! returns the length
  IndexType getLength() const { return d_length; };

  //! returns the sum of all the elements in the vect
  //! the doAbs argument toggles summing the absolute values of the elements
  int getTotalVal(bool doAbs = false) const {
    int res = 0;
    typename StorageType::const_iterator iter;
    for (iter = d_data.begin(); iter != d_data.end(); ++iter) {
      if (!doAbs)
        res += iter->second;
      else
        res += abs(iter->second);
    }
    return res;
  };
  //! returns the length
  unsigned int size() const { return getLength(); };

  //! returns our nonzero elements as a map(IndexType->int)
  const StorageType &getNonzeroElements() const { return d_data; }

  //! this is a "fuzzy" intesection, the final value
  //! of each element is equal to the minimum from
  //! the two vects.
  SparseIntVect<IndexType> &operator&=(const SparseIntVect<IndexType> &other) {
    if (other.d_length != d_length) {
      throw ValueErrorException("SparseIntVect size mismatch");
    }

    typename StorageType::iterator iter = d_data.begin();
    typename StorageType::const_iterator oIter = other.d_data.begin();
    while (iter != d_data.end()) {
      // we're relying on the fact that the maps are sorted:
      while (oIter != other.d_data.end() && oIter->first < iter->first) {
        ++oIter;
      }
      if (oIter != other.d_data.end() && oIter->first == iter->first) {
        // found it:
        if (oIter->second < iter->second) {
          iter->second = oIter->second;
        }
        ++oIter;
        ++iter;
      } else {
        // not there; our value is zero, which means
        // we should remove this value:
        typename StorageType::iterator tmpIter = iter;
        ++tmpIter;
        d_data.erase(iter);
        iter = tmpIter;
      }
    }
    return *this;
  };
  const SparseIntVect<IndexType> operator&(
      const SparseIntVect<IndexType> &other) const {
    SparseIntVect<IndexType> res(*this);
    return res &= other;
  }

  //! this is a "fuzzy" union, the final value
  //! of each element is equal to the maximum from
  //! the two vects.
  SparseIntVect<IndexType> &operator|=(const SparseIntVect<IndexType> &other) {
    if (other.d_length != d_length) {
      throw ValueErrorException("SparseIntVect size mismatch");
    }

    typename StorageType::iterator iter = d_data.begin();
    typename StorageType::const_iterator oIter = other.d_data.begin();
    while (iter != d_data.end()) {
      // we're relying on the fact that the maps are sorted:
      while (oIter != other.d_data.end() && oIter->first < iter->first) {
        d_data[oIter->first] = oIter->second;
        ++oIter;
      }
      if (oIter != other.d_data.end() && oIter->first == iter->first) {
        // found it:
        if (oIter->second > iter->second) {
          iter->second = oIter->second;
        }
        ++oIter;
      }
      ++iter;
    }
    // finish up the other vect:
    while (oIter != other.d_data.end()) {
      d_data[oIter->first] = oIter->second;
      ++oIter;
    }
    return *this;
  };
  const SparseIntVect<IndexType> operator|(
      const SparseIntVect<IndexType> &other) const {
    SparseIntVect<IndexType> res(*this);
    return res |= other;
  }

  SparseIntVect<IndexType> &operator+=(const SparseIntVect<IndexType> &other) {
    if (other.d_length != d_length) {
      throw ValueErrorException("SparseIntVect size mismatch");
    }
    typename StorageType::iterator iter = d_data.begin();
    typename StorageType::const_iterator oIter = other.d_data.begin();
    while (oIter != other.d_data.end()) {
      while (iter != d_data.end() && iter->first < oIter->first) {
        ++iter;
      }
      if (iter != d_data.end() && oIter->first == iter->first) {
        // found it:
        iter->second += oIter->second;
        if (!iter->second) {
          typename StorageType::iterator tIter = iter;
          ++tIter;
          d_data.erase(iter);
          iter = tIter;
        } else {
          ++iter;
        }
      } else {
        d_data[oIter->first] = oIter->second;
      }
      ++oIter;
    }
    return *this;
  };
  const SparseIntVect<IndexType> operator+(
      const SparseIntVect<IndexType> &other) const {
    SparseIntVect<IndexType> res(*this);
    return res += other;
  }

  SparseIntVect<IndexType> &operator-=(const SparseIntVect<IndexType> &other) {
    if (other.d_length != d_length) {
      throw ValueErrorException("SparseIntVect size mismatch");
    }
    typename StorageType::iterator iter = d_data.begin();
    typename StorageType::const_iterator oIter = other.d_data.begin();
    while (oIter != other.d_data.end()) {
      while (iter != d_data.end() && iter->first < oIter->first) {
        ++iter;
      }
      if (iter != d_data.end() && oIter->first == iter->first) {
        // found it:
        iter->second -= oIter->second;
        if (!iter->second) {
          typename StorageType::iterator tIter = iter;
          ++tIter;
          d_data.erase(iter);
          iter = tIter;
        } else {
          ++iter;
        }
      } else {
        d_data[oIter->first] = -oIter->second;
      }
      ++oIter;
    }
    return *this;
  };
  const SparseIntVect<IndexType> operator-(
      const SparseIntVect<IndexType> &other) const {
    SparseIntVect<IndexType> res(*this);
    return res -= other;
  }
  SparseIntVect<IndexType> &operator*=(int v) {
    typename StorageType::iterator iter = d_data.begin();
    while (iter != d_data.end()) {
      iter->second *= v;
      ++iter;
    }
    return *this;
  };
  SparseIntVect<IndexType> &operator*(int v) {
    SparseIntVect<IndexType> res(*this);
    return res *= v;
  };
  SparseIntVect<IndexType> &operator/=(int v) {
    typename StorageType::iterator iter = d_data.begin();
    while (iter != d_data.end()) {
      iter->second /= v;
      ++iter;
    }
    return *this;
  };
  SparseIntVect<IndexType> &operator/(int v) {
    SparseIntVect<IndexType> res(*this);
    return res /= v;
  };
  SparseIntVect<IndexType> &operator+=(int v) {
    typename StorageType::iterator iter = d_data.begin();
    while (iter != d_data.end()) {
      iter->second += v;
      ++iter;
    }
    return *this;
  };
  SparseIntVect<IndexType> &operator+(int v) {
    SparseIntVect<IndexType> res(*this);
    return res += v;
  };
  SparseIntVect<IndexType> &operator-=(int v) {
    typename StorageType::iterator iter = d_data.begin();
    while (iter != d_data.end()) {
      iter->second -= v;
      ++iter;
    }
    return *this;
  };
  SparseIntVect<IndexType> &operator-(int v) {
    SparseIntVect<IndexType> res(*this);
    return res -= v;
  };

  bool operator==(const SparseIntVect<IndexType> &v2) const {
    if (d_length != v2.d_length) {
      return false;
    }
    return d_data == v2.d_data;
  }
  bool operator!=(const SparseIntVect<IndexType> &v2) const {
    return !(*this == v2);
  }

  //! returns a binary string representation (pickle)
  std::string toString() const {
    std::stringstream ss(std::ios_base::binary | std::ios_base::out |
                         std::ios_base::in);
    boost::uint32_t tInt;
    tInt = ci_SPARSEINTVECT_VERSION;
    streamWrite(ss, tInt);
    tInt = sizeof(IndexType);
    streamWrite(ss, tInt);
    streamWrite(ss, d_length);
    IndexType nEntries = d_data.size();
    streamWrite(ss, nEntries);

    typename StorageType::const_iterator iter = d_data.begin();
    while (iter != d_data.end()) {
      streamWrite(ss, iter->first);
      boost::int32_t tInt = iter->second;
      streamWrite(ss, tInt);
      ++iter;
    }
    return ss.str();
  };

  void fromString(const std::string &txt) {
    initFromText(txt.c_str(), txt.length());
  }

 private:
  IndexType d_length;
  StorageType d_data;

  void initFromText(const char *pkl, const unsigned int len) {
    d_data.clear();
    std::stringstream ss(std::ios_base::binary | std::ios_base::out |
                         std::ios_base::in);
    ss.write(pkl, len);

    boost::uint32_t vers;
    streamRead(ss, vers);
    if (vers == 0x0001) {
      boost::uint32_t tInt;
      streamRead(ss, tInt);
      if (tInt > sizeof(IndexType)) {
        throw ValueErrorException(
            "IndexType cannot accomodate index size in SparseIntVect pickle");
      }
      switch (tInt) {
        case sizeof(char):
          readVals<unsigned char>(ss);
          break;
        case sizeof(boost::int32_t):
          readVals<boost::uint32_t>(ss);
          break;
        case sizeof(boost::int64_t):
          readVals<boost::uint64_t>(ss);
          break;
        default:
          throw ValueErrorException("unreadable format");
      }
    } else {
      throw ValueErrorException("bad version in SparseIntVect pickle");
    }
  };
  template <typename T>
  void readVals(std::stringstream &ss) {
    PRECONDITION(sizeof(T) <= sizeof(IndexType), "invalid size");
    T tVal;
    streamRead(ss, tVal);
    d_length = tVal;
    T nEntries;
    streamRead(ss, nEntries);
    for (T i = 0; i < nEntries; ++i) {
      streamRead(ss, tVal);
      boost::int32_t val;
      streamRead(ss, val);
      d_data[tVal] = val;
    }
  }
};

template <typename IndexType, typename SequenceType>
void updateFromSequence(SparseIntVect<IndexType> &vect,
                        const SequenceType &seq) {
  typename SequenceType::const_iterator seqIt;
  for (seqIt = seq.begin(); seqIt != seq.end(); ++seqIt) {
    // EFF: probably not the most efficient approach
    IndexType idx = *seqIt;
    vect.setVal(idx, vect.getVal(idx) + 1);
  }
}

namespace {
template <typename IndexType>
void calcVectParams(const SparseIntVect<IndexType> &v1,
                    const SparseIntVect<IndexType> &v2, double &v1Sum,
                    double &v2Sum, double &andSum) {
  if (v1.getLength() != v2.getLength()) {
    throw ValueErrorException("SparseIntVect size mismatch");
  }
  v1Sum = v2Sum = andSum = 0.0;
  // we're doing : (v1&v2).getTotalVal(), but w/o generating
  // the other vector:
  typename SparseIntVect<IndexType>::StorageType::const_iterator iter1, iter2;
  iter1 = v1.getNonzeroElements().begin();
  if (iter1 != v1.getNonzeroElements().end()) v1Sum += abs(iter1->second);
  iter2 = v2.getNonzeroElements().begin();
  if (iter2 != v2.getNonzeroElements().end()) v2Sum += abs(iter2->second);
  while (iter1 != v1.getNonzeroElements().end()) {
    while (iter2 != v2.getNonzeroElements().end() &&
           iter2->first < iter1->first) {
      ++iter2;
      if (iter2 != v2.getNonzeroElements().end()) v2Sum += abs(iter2->second);
    }
    if (iter2 != v2.getNonzeroElements().end()) {
      if (iter2->first == iter1->first) {
        if (abs(iter2->second) < abs(iter1->second)) {
          andSum += abs(iter2->second);
        } else {
          andSum += abs(iter1->second);
        }
        ++iter2;
        if (iter2 != v2.getNonzeroElements().end()) v2Sum += abs(iter2->second);
      }
      ++iter1;
      if (iter1 != v1.getNonzeroElements().end()) v1Sum += abs(iter1->second);
    } else {
      break;
    }
  }
  if (iter1 != v1.getNonzeroElements().end()) {
    ++iter1;
    while (iter1 != v1.getNonzeroElements().end()) {
      v1Sum += abs(iter1->second);
      ++iter1;
    }
  }
  if (iter2 != v2.getNonzeroElements().end()) {
    ++iter2;
    while (iter2 != v2.getNonzeroElements().end()) {
      v2Sum += abs(iter2->second);
      ++iter2;
    }
  }
}
}

template <typename IndexType>
double DiceSimilarity(const SparseIntVect<IndexType> &v1,
                      const SparseIntVect<IndexType> &v2,
                      bool returnDistance = false, double bounds = 0.0) {
  if (v1.getLength() != v2.getLength()) {
    throw ValueErrorException("SparseIntVect size mismatch");
  }
  double v1Sum = 0.0;
  double v2Sum = 0.0;
  if (!returnDistance && bounds > 0.0) {
    v1Sum = v1.getTotalVal(true);
    v2Sum = v2.getTotalVal(true);
    double denom = v1Sum + v2Sum;
    if (fabs(denom) < 1e-6) {
      if (returnDistance) {
        return 1.0;
      } else {
        return 0.0;
      }
    }
    double minV = v1Sum < v2Sum ? v1Sum : v2Sum;
    if (2. * minV / denom < bounds) {
      return 0.0;
    }
    v1Sum = 0.0;
    v2Sum = 0.0;
  }

  double numer = 0.0;

  calcVectParams(v1, v2, v1Sum, v2Sum, numer);

  double denom = v1Sum + v2Sum;
  double sim;
  if (fabs(denom) < 1e-6) {
    sim = 0.0;
  } else {
    sim = 2. * numer / denom;
  }
  if (returnDistance) sim = 1. - sim;
  // std::cerr<<" "<<v1Sum<<" "<<v2Sum<<" " << numer << " " << sim <<std::endl;
  return sim;
}

template <typename IndexType>
double TverskySimilarity(const SparseIntVect<IndexType> &v1,
                         const SparseIntVect<IndexType> &v2, double a, double b,
                         bool returnDistance = false, double bounds = 0.0) {
  RDUNUSED_PARAM(bounds);
  if (v1.getLength() != v2.getLength()) {
    throw ValueErrorException("SparseIntVect size mismatch");
  }
  double v1Sum = 0.0;
  double v2Sum = 0.0;
  double andSum = 0.0;

  calcVectParams(v1, v2, v1Sum, v2Sum, andSum);

  double denom = a * v1Sum + b * v2Sum + (1 - a - b) * andSum;
  double sim;

  if (fabs(denom) < 1e-6) {
    sim = 0.0;
  } else {
    sim = andSum / denom;
  }
  if (returnDistance) sim = 1. - sim;
  // std::cerr<<" "<<v1Sum<<" "<<v2Sum<<" " << numer << " " << sim <<std::endl;
  return sim;
}

template <typename IndexType>
double TanimotoSimilarity(const SparseIntVect<IndexType> &v1,
                          const SparseIntVect<IndexType> &v2,
                          bool returnDistance = false, double bounds = 0.0) {
  return TverskySimilarity(v1, v2, 1.0, 1.0, returnDistance, bounds);
}
}

#endif


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>LibDS: Class Members - Variables</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

LibDS

Qt-based library for controlling FRC robots

Main Page

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

All

Functions

Variables

Enumerations

Enumerator

axes
: DS::Joystick

buttons
: DS::Joystick

numAxes
: DS::Joystick

numButtons
: DS::Joystick

numPOVs
: DS::Joystick

povs
: DS::Joystick

realNumAxes
: DS::Joystick

realNumButtons
: DS::Joystick

realNumPOVs
: DS::Joystick

<address class="footer">
Generated by

 1.8.11
</address>


text:
import json, os, unittest
from StringIO import StringIO

# werkzeug import
from werkzeug import EnvironBuilder, Request, run_wsgi_app

# bewype import
from bewype.config import c
from bewype.flask.controllers import upload

class UploadTestCase(unittest.TestCase):

    def setUp(self):
        # upload file path
        self.upload_file_path = None

    def tearDown(self):
        # remove uploaded path
        if self.upload_file_path is not None\
        and os.path.exists(self.upload_file_path):
            os.remove(self.upload_file_path)

    def test_upload(self):
        # prepare form data
        _data = {'file': (StringIO('This is a test'), 'dummy.txt')}
        # build environ
        _builder = EnvironBuilder('/upload', method='POST', data=_data)
        _environ = _builder.get_environ()
        # call
        _app_iter, _status, _headers = run_wsgi_app(upload.app, _environ)
        # parse response
        for _i in _app_iter:
            # load data
            _data = json.loads(_i)
            # get filename
            _content_type = _data['contentType']
            _file_name = _data['fileName']
        # set upload path main var for removal
        self.upload_file_path = os.path.join(c.path.uploads, _file_name)
        # check content type
        assert _content_type == 'text/plain',\
                'Found: %s' % _content_type
        # check was uploaded
        assert os.path.exists(self.upload_file_path),\
                'Found: %s' % self.upload_file_path
        # open file
        _f = open(self.upload_file_path)
        # check content
        assert _f.read() == 'This is a test'
        _f.close()

if __name__ == '__main__':
    unittest.main()


text:
class Post
  attr_accessor :file_location, :permalink, :creation_datetime_obj, :formatted_time, :content

  def create(new_post_name, post_type)

    # clean new_post_name
    if (new_post_name[-5..-1] == ".html")
      new_post_name = new_post_name[0..-5]
    elsif (new_post_name[-6..-1] == ".mdown")
      new_post_name = new_post_name[0..-6]
    elsif (new_post_name[-4..-1] == ".htm")
      new_post_name = new_post_name[0..-4]
    end

    new_post_name = new_post_name.strip.gsub(' ', '-').gsub('?', '').gsub('.', '').gsub('!', '').gsub(':', '').gsub('"', '').gsub("'", "").gsub(":", "-").gsub(";","-").gsub("(", "").gsub(")", "")

    # Add file extension
    if post_type == "html"
      new_post_name = new_post_name + ".html"
    elsif post_type == "markdown"
      new_post_name = new_post_name + ".mdown"
    end

    # Add current time
    # current_time = Time.new.in_timezone('America/New_York')
    current_time = Time.new.in_timezone($my_timezone)

    @file_name = current_time.strftime "%Y-%m-%dT%H+%M+%S-" + new_post_name

    # If you're getting date parsing error because of spaces turning up in your file names somehow
    # try uncommenting the line below
    # @file_name = @file_name.gsub(' ', '0')

    # create a blank file
    new_post = File.new("../radiation_posts/#{@file_name}", 'w')
    new_post.close
  end

  def edit
    system "#{$my_text_editor_command} ../radiation_posts/#{@file_name}"
  end

  def get_datetime_object(file_location)
    # I just shove the full file_location into DateTime.parse, with a gsub for the time colons, and it works like magic
    DateTime.parse(file_location.gsub('+', ':'))
  end

  def get_formatted_timestamp(datetime_object)
    datetime_object.strftime "%l:%M%P, %A, %b %d, %Y"
  end
end


text:
namespace lc3
{
namespace core
{
namespace asmbl
{
    enum class TokenType {
          INVALID = 0
        , NUM
        , STRING
        , EOS

        , INST
        , REG
        , PSEUDO
        , LABEL
    };

    struct Token
    {
        Token(void);

        TokenType type;
        std::string str;
        int32_t num;

        uint32_t row, col, len;
        std::string line;
    };

    struct StatementToken : public Token
    {
        using Token::Token;

        StatementToken(void);
        StatementToken(Token const & that);

        uint32_t lev_dist;
        uint32_t pc;
    };

    struct Statement
    {
        bool isPseudo(void) const;
        bool isInst(void) const;
        bool hasLabel(void) const;
        bool isLabel(void) const;

        StatementToken label;
        StatementToken inst_or_pseudo;
        uint32_t pc;

        std::vector<StatementToken> operands;
        std::vector<StatementToken> invalid_operands;

        std::string line;
    };
};
};
};

std::ostream & operator<<(std::ostream & out, lc3::core::asmbl::StatementToken const & x);
std::ostream & operator<<(std::ostream & out, lc3::core::asmbl::Statement const & x);

#endif


text:
using System;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Octokit.Tests.Integration.Helpers;
using Xunit;

public class IssueReactionsClientTests
{
    public class TheCreateReactionMethod : IDisposable
    {
        private readonly RepositoryContext _context;
        private readonly IIssuesClient _issuesClient;
        private readonly IGitHubClient _github;

        public TheCreateReactionMethod()
        {
            _github = Helper.GetAuthenticatedClient();

            _issuesClient = _github.Issue;

            var repoName = Helper.MakeNameWithTimestamp("public-repo");
            _context = _github.CreateRepositoryContext(new NewRepository(repoName)).Result;
        }

        [IntegrationTest]
        public async Task CanListReactions()
        {
            var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
            var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);

            Assert.NotNull(issue);

            var issueReaction = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new NewReaction(ReactionType.Heart));

            var issueReactions = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number);

            Assert.NotEmpty(issueReactions);

            Assert.Equal(issueReaction.Id, issueReactions[0].Id);
            Assert.Equal(issueReaction.Content, issueReactions[0].Content);
        }

        [IntegrationTest]
        public async Task CanListReactionsWithRepositoryId()
        {
            var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
            var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);

            Assert.NotNull(issue);

            var issueReaction = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new NewReaction(ReactionType.Heart));

            var issueReactions = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number);

            Assert.NotEmpty(issueReactions);

            Assert.Equal(issueReaction.Id, issueReactions[0].Id);
            Assert.Equal(issueReaction.Content, issueReactions[0].Content);
        }

        [IntegrationTest]
        public async Task CanCreateReaction()
        {
            var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
            var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);

            Assert.NotNull(issue);

            foreach (ReactionType reactionType in Enum.GetValues(typeof(ReactionType)))
            {
                var newReaction = new NewReaction(reactionType);

                var reaction = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newReaction);

                Assert.IsType<Reaction>(reaction);
                Assert.Equal(reactionType, reaction.Content);
                Assert.Equal(issue.User.Id, reaction.User.Id);
            }
        }

        [IntegrationTest]
        public async Task CanCreateReactionWithRepositoryId()
        {
            var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
            var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);

            Assert.NotNull(issue);

            var issueReaction = await _github.Reaction.Issue.Create(_context.Repository.Id, issue.Number, new NewReaction(ReactionType.Heart));

            Assert.NotNull(issueReaction);

            Assert.IsType<Reaction>(issueReaction);

            Assert.Equal(ReactionType.Heart, issueReaction.Content);

            Assert.Equal(issue.User.Id, issueReaction.User.Id);
        }

        public void Dispose()
        {
            _context.Dispose();
        }
    }
}


text:
package eu.faredge.edgeInfrastructure.registry.repo.service;

import java.util.List;

import eu.faredge.edgeInfrastructure.registry.repo.model.DSM;

public interface DsmServiceInterface
{
	DSM findByUri(String uri);
	DSM findByMacAddress(String macAddress);
	List<DSM> getAllDsms();
	List<DSM> findByDataSourceDefinitionReferenceID(String dataSourceDefinitionReferenceID);
	boolean delete(DSM dsm);
	boolean deleteByUri(String uri);
	boolean deleteById(String uri);
	boolean addDsm(DSM dsm);

}


text:
var assert = require('assert'),
    fs = require('fs'),
    sourcemap = require('source-map'),
    charProps = require('char-props'),
    jsmin = require('../'),
    SourceMapConsumer = sourcemap.SourceMapConsumer,
    testFilesDir = __dirname + '/test_files';

function minifySingle() {
  before(function () {
    // Read in the src file
    var params = this.params,
        src = params.src,
        singleSrc = fs.readFileSync(testFilesDir + '/' + src, 'utf8');

    // Save to the code namespace
    this.input = [{'src': src, 'code': singleSrc}];
    this.result = jsmin({'code': singleSrc, 'src': src, 'dest': params.dest});
  });
}

function minifyMulti() {
  before(function () {
    // Localize the src
    var params = this.params,
        src = params.src;

    // Read in the src files
    var srcFiles = src.map(function (filepath) {
      var fileSrc = fs.readFileSync(testFilesDir + '/' + filepath, 'utf8'),
          retObj = {
            'code': fileSrc,
            'src': filepath
          };
      return retObj;
    });

    // Save relevant info
    this.input = srcFiles;
    this.result = jsmin({'input': srcFiles, 'dest': params.dest});
  });
}

function assertMatchesC() {
  it('matches its C-minified counterpart', function () {
    var params = this.params,
        expectedCode = fs.readFileSync(__dirname + '/expected_files/' + params.dest, 'utf8');
    assert.strictEqual(
      this.result.code,
      expectedCode,
      'Minified ' + JSON.stringify(params.src) + ' does not match ' + params.dest
    );
  });
}

function mapAgainstSource() {
  before(function () {
    // Iterate over the input
    var srcPropMap = {};
    this.input.forEach(function (item) {
      srcPropMap[item.src] = charProps(item.code);
    });

    // Generate a consumer and charProps lookups
    var result = this.result;
    this.srcConsumer = new SourceMapConsumer(result.sourcemap);
    this.actualProps = charProps(result.code);
    this.srcPropMap = srcPropMap;
  });
}

function assertAllPositionsMatch() {
  it('matches at all positions', function () {
    // Iterate over each of the characters
    var breaks = this.expectedBreaks || [],
        result = this.result,
        actualCode = result.code,
        actualProps = this.actualProps,
        i = 0,
        len = actualCode.length;
    for (; i < len; i++) {
      // Look up the position of our index
      var actualPosition = {
        'line': actualProps.lineAt(i) + 1,
        'column': actualProps.columnAt(i)
      };

      // Grab the position of the item and its fil
      var srcPosition = this.srcConsumer.originalPositionFor(actualPosition),
          srcFile = srcPosition.source;

      // If we have a source file and we are not at a break spot
      // TODO: Actually figure out `breaks`
      var atBreakSpot = breaks.indexOf(i) > -1;
      if (srcFile && !atBreakSpot) {
        // Grab the srcProps for it
        var srcProps = this.srcPropMap[srcFile];

        // Lookup the character at the src positions
        var srcLine = srcPosition.line - 1,
            srcCol = srcPosition.column,
            srcChar = srcProps.charAt({
              'line': srcLine,
              'column': srcCol
            });

        // Assert that the actual and expected characters are equal
        var actualChar = actualCode.charAt(i);
        // DEV: Nuking character comparison for break location so we can find it via error message
        // assert.strictEqual(actualChar, srcChar, 'The sourcemapped character at index ' + i + ' does not match its original character at line ' + srcLine + ', column ' + srcCol + '.');
        assert(actualChar === srcChar, 'The sourcemapped character at index ' + i + ' does not match its original character at line ' + srcLine + ', column ' + srcCol + '.');
      }
    }
  });
}

function isDebuggable() {
  if (process.env.TEST_DEBUG) {
    before(function () {
      try { fs.mkdirSync(__dirname + '/actual_files'); } catch (e) {}
      fs.writeFileSync(__dirname + '/actual_files/debug.min.js', this.result.code, 'utf8');
      fs.writeFileSync(__dirname + '/actual_files/debug.min.map', this.result.sourcemap, 'utf8');
    });
  }
}

describe('A single file', function () {
  before(function jQueryPaths () {
    this.params = {'src': '1.js', 'dest': 'single.js'};
  });

  describe('minified and sourcemapped (single)', function () {
    minifySingle();
    isDebuggable();

    assertMatchesC();

    describe('mapped against its source', function () {
      mapAgainstSource();

      assertAllPositionsMatch();
    });
  });
});

describe('jQuery', function () {
  before(function jQueryPaths () {
    this.params = {'src': 'jquery.js', 'dest': 'jquery.min.js'};
  });

  describe('minified and sourcemapped (single)', function () {
    minifySingle();
    isDebuggable();

    assertMatchesC();
  });
});

describe('Multiple files', function () {
  before(function multiPaths () {
    this.params = {'src': ['1.js', '2.js', '3.js'], 'dest': 'multi.js'};
    this.expectedBreaks = [52, 70];
  });

  describe('minified and sourcemapped (multi)', function () {
    minifyMulti();
    isDebuggable();

    assertMatchesC();

    describe('mapped against its source', function () {
      mapAgainstSource();

      assertAllPositionsMatch();
    });
  });
});

describe('Multiple nested files', function () {
  before(function () {
    this.params = {
      'src': [
        'nested.js',
        'nested/controllers/controller1.js',
        'nested/controllers/controller2.js',
        'nested/models/model1.js'
      ],
      'dest': 'nested.min.js'
    };
    this.expectedBreaks = [1, 43, 88, 100];
  });

  describe('minified and sourcemapped (multi)', function () {
    minifyMulti();
    isDebuggable();

    assertMatchesC();

    describe('mapped against its source', function () {
      mapAgainstSource();

      assertAllPositionsMatch();
    });
  });
});

describe('Multiple files containing "use strict"', function () {
  before(function () {
    this.params = {
      'src': [
        'strict1.js',
        'strict2.js'
      ],
      'dest': 'strict.min.js'
    };
    this.expectedBreaks = [36];
  });

  describe('minified and sourcemapped (multi)', function () {
    minifyMulti();
    isDebuggable();

    // DEV: This is not the actual C output. The C one doesn't contain line breaks which can break concatenated scripts.
    assertMatchesC();

    describe('mapped against its source', function () {
      mapAgainstSource();

      assertAllPositionsMatch();
    });
  });
});

describe('Multiple files containing "use strict" 2', function () {
  before(function () {
    this.params = {
      'src': [
        'strict3.js',
        'strict4.js'
      ],
      'dest': 'strict2.min.js'
    };
    this.expectedBreaks = [135];
  });

  describe('minified and sourcemapped (multi)', function () {
    minifyMulti();
    isDebuggable();

    // DEV: This is not the actual C output. The C one doesn't contain line breaks which can break concatenated scripts.
    assertMatchesC();

    describe('mapped against its source', function () {
      mapAgainstSource();

      assertAllPositionsMatch();
    });
  });
});


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BankProgram
{
    class Program
    {
        static void Main(string[] args)
        {
            var bank = new Bank();

            Debug.Assert(bank.AccountsCount > 0);

        }
    }
}


text:
package org.kuali.kra.s2s.generator.impl;

import gov.grants.apply.forms.rrBudget10V11.BudgetTypeDataType;
import gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType;
import gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.*;
import gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.Equipment.EquipmentList;
import gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.KeyPersons.KeyPerson;
import gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherPersonnel.GraduateStudents;
import gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherPersonnel.PostDocAssociates;
import gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherPersonnel.SecretarialClerical;
import gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherPersonnel.UndergraduateStudents;
import gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.ParticipantTraineeSupportCosts.Other;
import gov.grants.apply.forms.rrBudget10V11.RRBudget10Document;
import gov.grants.apply.forms.rrBudget10V11.RRBudget10Document.RRBudget10;
import gov.grants.apply.forms.rrBudget10V11.RRBudget10Document.RRBudget10.BudgetSummary;
import gov.grants.apply.system.attachmentsV10.AttachedFileDataType;
import gov.grants.apply.system.attachmentsV10.AttachedFileDataType.FileLocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xmlbeans.XmlObject;
import org.kuali.kra.budget.BudgetDecimal;
import org.kuali.kra.budget.core.BudgetService;
import org.kuali.kra.infrastructure.KraServiceLocator;
import org.kuali.kra.proposaldevelopment.bo.DevelopmentProposal;
import org.kuali.kra.proposaldevelopment.bo.Narrative;
import org.kuali.kra.proposaldevelopment.bo.ProposalPerson;
import org.kuali.kra.proposaldevelopment.document.ProposalDevelopmentDocument;
import org.kuali.kra.s2s.S2SException;
import org.kuali.kra.s2s.generator.bo.*;
import org.kuali.kra.s2s.util.S2SConstants;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 *
 * This class is to generate xml stream for grants.gov form RRBudget10-V1_1
 * ref schema namespace <code> http://apply.grants.gov/forms/RR_Budget10-V1.1</code>
 */
public class RRBudget10V1_1Generator extends RRBudgetBaseGenerator {

    private static final Log LOG = LogFactory.getLog(RRBudget10V1_1Generator.class);

    /**
     * This method returns RRBudget10Document object based on proposal development
     * document which contains the informations such as
     * DUNSID,OrganizationName,BudgetType,BudgetYear and BudgetSummary.
     *
     * @return rrBudgetDocument {@link XmlObject} of type RRBudget10Document.
     */
    private RRBudget10Document getRRBudget10() {

        deleteAutoGenNarratives();
        RRBudget10Document rrBudgetDocument = RRBudget10Document.Factory
                .newInstance();
        RRBudget10 rrBudget = RRBudget10.Factory.newInstance();
        rrBudget.setFormVersion(S2SConstants.FORMVERSION_1_1);
        if (pdDoc.getDevelopmentProposal().getApplicantOrganization() != null) {
            rrBudget.setDUNSID(pdDoc.getDevelopmentProposal()
                    .getApplicantOrganization().getOrganization()
                    .getDunsNumber());
            rrBudget.setOrganizationName(pdDoc.getDevelopmentProposal()
                    .getApplicantOrganization().getOrganization()
                    .getOrganizationName());
        }
        rrBudget.setBudgetType(BudgetTypeDataType.PROJECT);

        List<BudgetPeriodInfo> budgetperiodList;
        BudgetSummaryInfo budgetSummary = null;
        try {
            validateBudgetForForm(pdDoc);
            budgetperiodList = s2sBudgetCalculatorService.getBudgetPeriods(pdDoc);
            budgetSummary = s2sBudgetCalculatorService.getBudgetInfo(pdDoc,budgetperiodList);
        } catch (S2SException e) {
            LOG.error(e.getMessage(), e);
            return rrBudgetDocument;
        }

        rrBudget.setBudgetSummary(getBudgetSummary(budgetSummary));

        for (BudgetPeriodInfo budgetPeriodData : budgetperiodList) {
            setBudgetYearDataType(rrBudget,budgetPeriodData);
        }
        AttachedFileDataType attachedFileDataType = AttachedFileDataType.Factory.newInstance();
        for (Narrative narrative : pdDoc.getDevelopmentProposal().getNarratives()) {
            if (narrative.getNarrativeTypeCode() != null
                    && Integer.parseInt(narrative.getNarrativeTypeCode()) == 132) {
                attachedFileDataType = getAttachedFileType(narrative);
                if (attachedFileDataType != null) {
                    break;
                }
            }
        }
        rrBudget.setBudgetJustificationAttachment(attachedFileDataType);
        rrBudgetDocument.setRRBudget10(rrBudget);
        return rrBudgetDocument;
    }

    /**
     * This method gets BudgetYearDataType details like
     * BudgetPeriodStartDate,BudgetPeriodEndDate,BudgetPeriod
     * KeyPersons,OtherPersonnel,TotalCompensation,Equipment,ParticipantTraineeSupportCosts,Travel,OtherDirectCosts
     * DirectCosts,IndirectCosts,CognizantFederalAgency,TotalCosts based on
     * BudgetPeriodInfo for the RRBudget10.
     *
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     * @return BudgetYear1DataType corresponding to the BudgetSummaryInfo
     *         object.
     */
    private void setBudgetYearDataType(RRBudget10 rrBudget,BudgetPeriodInfo periodInfo) {

        BudgetYearDataType budgetYear = rrBudget.addNewBudgetYear();
        if (periodInfo != null) {
            budgetYear.setBudgetPeriodStartDate(s2sUtilService.convertDateToCalendar(periodInfo.getStartDate()));
            budgetYear.setBudgetPeriodEndDate(s2sUtilService.convertDateToCalendar(periodInfo.getEndDate()));
            budgetYear.setKeyPersons(getKeyPersons(periodInfo));
            budgetYear.setOtherPersonnel(getOtherPersonnel(periodInfo));
            if (periodInfo.getTotalCompensation() != null) {
                budgetYear.setTotalCompensation(periodInfo
                        .getTotalCompensation().bigDecimalValue());
            }
            budgetYear.setEquipment(getEquipment(periodInfo));
            budgetYear.setTravel(getTravel(periodInfo));
            budgetYear
                    .setParticipantTraineeSupportCosts(getParticipantTraineeSupportCosts(periodInfo));
            budgetYear.setOtherDirectCosts(getOtherDirectCosts(periodInfo));
            BigDecimal directCosts = periodInfo.getDirectCostsTotal()
                    .bigDecimalValue();
            budgetYear.setDirectCosts(directCosts);
            IndirectCosts indirectCosts = getIndirectCosts(periodInfo);
            if (indirectCosts != null) {
                budgetYear.setIndirectCosts(indirectCosts);
                budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue().add(indirectCosts.getTotalIndirectCosts()));
            }else{
                budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue());
            }
            budgetYear.setCognizantFederalAgency(periodInfo
                    .getCognizantFedAgency());
        }
    }

    /**
     * This method gets BudgetSummary details such as
     * CumulativeTotalFundsRequestedSeniorKeyPerson,CumulativeTotalFundsRequestedOtherPersonnel
     * CumulativeTotalNoOtherPersonnel,CumulativeTotalFundsRequestedPersonnel,CumulativeEquipments,CumulativeTravels
     * CumulativeTrainee,CumulativeOtherDirect,CumulativeTotalFundsRequestedDirectCosts,CumulativeTotalFundsRequestedIndirectCost
     * CumulativeTotalFundsRequestedDirectIndirectCosts and CumulativeFee based
     * on BudgetSummaryInfo for the RRBudget10.
     *
     * @param budgetSummaryData
     *            (BudgetSummaryInfo) budget summary entry.
     * @return BudgetSummary details corresponding to the BudgetSummaryInfo
     *         object.
     */
    private BudgetSummary getBudgetSummary(BudgetSummaryInfo budgetSummaryData) {

        BudgetSummary budgetSummary = BudgetSummary.Factory.newInstance();
        OtherDirectCostInfo otherDirectCosts = null;
        if(budgetSummaryData!=null){
            if(budgetSummaryData.getOtherDirectCosts()!=null && budgetSummaryData.getOtherDirectCosts().size() > 0 ){
                otherDirectCosts = budgetSummaryData.getOtherDirectCosts().get(0);
            }
            if(otherDirectCosts!=null){

                budgetSummary.setCumulativeTotalFundsRequestedSeniorKeyPerson(BigDecimal.ZERO);
                budgetSummary.setCumulativeTotalFundsRequestedPersonnel(BigDecimal.ZERO);

                if (budgetSummaryData.getCumTotalFundsForSrPersonnel() != null) {
                    budgetSummary
                            .setCumulativeTotalFundsRequestedSeniorKeyPerson(budgetSummaryData
                                    .getCumTotalFundsForSrPersonnel().bigDecimalValue());
                }
                if (budgetSummaryData.getCumTotalFundsForOtherPersonnel() != null) {
                    budgetSummary
                            .setCumulativeTotalFundsRequestedOtherPersonnel(budgetSummaryData
                                    .getCumTotalFundsForOtherPersonnel()
                                    .bigDecimalValue());
                }
                if (budgetSummaryData.getCumNumOtherPersonnel() != null) {
                    budgetSummary.setCumulativeTotalNoOtherPersonnel(budgetSummaryData
                            .getCumNumOtherPersonnel().intValue());
                }
                if (budgetSummaryData.getCumTotalFundsForPersonnel() != null) {
                    budgetSummary
                            .setCumulativeTotalFundsRequestedPersonnel(budgetSummaryData
                                    .getCumTotalFundsForPersonnel().bigDecimalValue());
                }
                budgetSummary.setCumulativeTotalFundsRequestedEquipment(budgetSummaryData.getCumEquipmentFunds().bigDecimalValue());
                budgetSummary.setCumulativeTotalFundsRequestedTravel(budgetSummaryData.getCumTravel().bigDecimalValue());
                budgetSummary.setCumulativeDomesticTravelCosts(budgetSummaryData.getCumDomesticTravel().bigDecimalValue());
                budgetSummary.setCumulativeForeignTravelCosts(budgetSummaryData.getCumForeignTravel().bigDecimalValue());
                budgetSummary.setCumulativeTotalFundsRequestedTraineeCosts(budgetSummaryData.getpartOtherCost()
                            .add(budgetSummaryData.getpartStipendCost()
                                    .add(budgetSummaryData.getpartTravelCost()
                                            .add(budgetSummaryData.getPartTuition()
                                                    .add(budgetSummaryData.getPartSubsistence())))).bigDecimalValue());
                budgetSummary.setCumulativeTraineeStipends(otherDirectCosts.getPartStipends().bigDecimalValue());
                budgetSummary.setCumulativeTraineeSubsistence(otherDirectCosts.getPartSubsistence().bigDecimalValue());
                budgetSummary.setCumulativeTraineeTravel(otherDirectCosts.getPartTravel().bigDecimalValue());
                budgetSummary.setCumulativeTraineeTuitionFeesHealthInsurance(otherDirectCosts.getPartTuition().bigDecimalValue());
                budgetSummary.setCumulativeOtherTraineeCost(budgetSummaryData.getpartOtherCost().bigDecimalValue());
                budgetSummary.setCumulativeNoofTrainees(budgetSummaryData.getparticipantCount());
                budgetSummary.setCumulativeTotalFundsRequestedOtherDirectCosts(otherDirectCosts.gettotalOtherDirect().bigDecimalValue());
                budgetSummary.setCumulativeMaterialAndSupplies(otherDirectCosts.getmaterials().bigDecimalValue());
                budgetSummary.setCumulativePublicationCosts(otherDirectCosts.getpublications().bigDecimalValue());
                budgetSummary.setCumulativeConsultantServices(otherDirectCosts.getConsultants().bigDecimalValue());
                budgetSummary.setCumulativeADPComputerServices(otherDirectCosts.getcomputer().bigDecimalValue());
                budgetSummary.setCumulativeSubawardConsortiumContractualCosts(otherDirectCosts.getsubAwards().bigDecimalValue());
                budgetSummary.setCumulativeEquipmentFacilityRentalFees(otherDirectCosts.getEquipRental().bigDecimalValue());
                budgetSummary.setCumulativeAlterationsAndRenovations(otherDirectCosts.getAlterations().bigDecimalValue());
                List<Map<String,String>> cvOthers = otherDirectCosts.getOtherCosts();
                for (int j = 0; j < cvOthers.size(); j++) {
                    Map<String, String> hmCosts = cvOthers.get(j);
                    if (j==0){
                        budgetSummary.setCumulativeOther1DirectCost(new BigDecimal(hmCosts.get(S2SConstants.KEY_COST).toString()));
                       } else if (j==1) {
                           budgetSummary.setCumulativeOther2DirectCost(new BigDecimal(hmCosts.get(S2SConstants.KEY_COST).toString()));
                       } else {
                        budgetSummary.setCumulativeOther3DirectCost(new BigDecimal(hmCosts.get(S2SConstants.KEY_COST).toString()));
                     }
                }
                budgetSummary.setCumulativeTotalFundsRequestedDirectCosts(budgetSummaryData
                                .getCumTotalDirectCosts().bigDecimalValue());
                budgetSummary.setCumulativeTotalFundsRequestedIndirectCost(budgetSummaryData
                                .getCumTotalIndirectCosts().bigDecimalValue());
                budgetSummary.setCumulativeTotalFundsRequestedDirectIndirectCosts(budgetSummaryData
                                .getCumTotalCosts().bigDecimalValue());
                if (budgetSummaryData.getCumFee() != null) {
                    budgetSummary.setCumulativeFee(budgetSummaryData.getCumFee()
                            .bigDecimalValue());
                }
            }
        }
        return budgetSummary;
    }

    /**
     * This method gets ParticipantTraineeSupportCosts details in
     * BudgetYearDataType such as TuitionFeeHealthInsurance
     * Stipends,Subsistence,Travel,Other,ParticipantTraineeNumber and TotalCost
     * based on the BudgetPeriodInfo for the RRBudget10.
     *
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     * @return ParticipantTraineeSupportCosts corresponding to the
     *         BudgetPeriodInfo object.
     */
    private ParticipantTraineeSupportCosts getParticipantTraineeSupportCosts(
            BudgetPeriodInfo periodInfo) {

        ParticipantTraineeSupportCosts traineeSupportCosts = ParticipantTraineeSupportCosts.Factory
                .newInstance();
        if (periodInfo != null) {
            traineeSupportCosts.setTuitionFeeHealthInsurance(periodInfo
                    .getPartTuition().bigDecimalValue());
            traineeSupportCosts.setStipends(periodInfo.getpartStipendCost()
                    .bigDecimalValue());
            traineeSupportCosts.setTravel(periodInfo.getpartTravelCost()
                    .bigDecimalValue());
            traineeSupportCosts.setSubsistence(periodInfo.getPartSubsistence()
                    .bigDecimalValue());
            traineeSupportCosts.setOther(getOtherPTSupportCosts(periodInfo));
            traineeSupportCosts.setParticipantTraineeNumber(periodInfo
                    .getparticipantCount());
            traineeSupportCosts.setTotalCost(traineeSupportCosts.getTuitionFeeHealthInsurance()
                            .add(traineeSupportCosts.getStipends().add(traineeSupportCosts.getTravel()
                                 .add(traineeSupportCosts.getSubsistence().add(traineeSupportCosts.getOther().getCost())))));
        }
        return traineeSupportCosts;
    }

    /**
     * This method gets Other type description and total cost for
     * ParticipantTraineeSupportCosts based on BudgetPeriodInfo.
     *
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     * @return Other other participant trainee support costs corresponding to
     *         the BudgetPeriodInfo object.
     */
    private Other getOtherPTSupportCosts(BudgetPeriodInfo periodInfo) {
        Other other = Other.Factory.newInstance();
        other.setDescription(OTHERCOST_DESCRIPTION);
        BudgetDecimal otherCost = BudgetDecimal.ZERO;
        if (periodInfo != null && periodInfo.getpartOtherCost() != null) {
            otherCost = periodInfo.getpartOtherCost();
        }
        other.setCost(otherCost.bigDecimalValue());
        return other;
    }

    /**
     * This method gets OtherDirectCosts details such as
     * PublicationCosts,MaterialsSupplies,ConsultantServices,
     * ADPComputerServices,SubawardConsortiumContractualCosts,EquipmentRentalFee,AlterationsRenovations
     * and TotalOtherDirectCost in BudgetYearDataType based on BudgetPeriodInfo
     * for the RRBudget10.
     *
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     * @return OtherDirectCosts corresponding to the BudgetPeriodInfo object.
     */
    private OtherDirectCosts getOtherDirectCosts(BudgetPeriodInfo periodInfo) {

        OtherDirectCosts otherDirectCosts = OtherDirectCosts.Factory
                .newInstance();
        if (periodInfo != null && periodInfo.getOtherDirectCosts().size() > 0) {
            if (periodInfo.getOtherDirectCosts().get(0).getpublications() != null) {
                otherDirectCosts.setPublicationCosts(periodInfo
                        .getOtherDirectCosts().get(0).getpublications()
                        .bigDecimalValue());
            }
            if (periodInfo.getOtherDirectCosts().get(0).getmaterials() != null) {
                otherDirectCosts.setMaterialsSupplies(periodInfo
                        .getOtherDirectCosts().get(0).getmaterials()
                        .bigDecimalValue());
            }
            if (periodInfo.getOtherDirectCosts().get(0).getConsultants() != null) {
                otherDirectCosts.setConsultantServices(periodInfo
                        .getOtherDirectCosts().get(0).getConsultants()
                        .bigDecimalValue());
            }
            if (periodInfo.getOtherDirectCosts().get(0).getcomputer() != null) {
                otherDirectCosts.setADPComputerServices(periodInfo
                        .getOtherDirectCosts().get(0).getcomputer()
                        .bigDecimalValue());
            }
            if (periodInfo.getOtherDirectCosts().get(0).getsubAwards() != null) {
                otherDirectCosts
                        .setSubawardConsortiumContractualCosts(periodInfo
                                .getOtherDirectCosts().get(0).getsubAwards()
                                .bigDecimalValue());
            }
            if (periodInfo.getOtherDirectCosts().get(0).getAlterations() != null) {
                otherDirectCosts.setAlterationsRenovations(periodInfo
                        .getOtherDirectCosts().get(0).getAlterations()
                        .bigDecimalValue());
            }
            if (periodInfo.getOtherDirectCosts().get(0).getEquipRental() != null) {
                otherDirectCosts.setEquipmentRentalFee(periodInfo
                        .getOtherDirectCosts().get(0).getEquipRental()
                        .bigDecimalValue());
            }
            setOthersForOtherDirectCosts(otherDirectCosts,periodInfo);
            if (periodInfo.getOtherDirectCosts().get(0).gettotalOtherDirect() != null) {
                otherDirectCosts.setTotalOtherDirectCost(periodInfo
                        .getOtherDirectCosts().get(0).gettotalOtherDirect()
                        .bigDecimalValue());
            }
        }
        return otherDirectCosts;
    }

    /**
     * This method returns IndirectCosts details such as
     * Base,CostType,FundRequested,Rate and TotalIndirectCosts in
     * BudgetYearDataType based on BudgetPeriodInfo for the RRBudget10.
     *
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     * @return IndirectCosts corresponding to the BudgetPeriodInfo object.
     */
    private IndirectCosts getIndirectCosts(BudgetPeriodInfo periodInfo) {

        IndirectCosts indirectCosts = null;

        if (periodInfo != null
                && periodInfo.getIndirectCosts() != null
                && periodInfo.getIndirectCosts().getIndirectCostDetails() != null) {

            List<IndirectCosts.IndirectCost> indirectCostList = new ArrayList<IndirectCosts.IndirectCost>();
            int IndirectCostCount = 0;
            for (IndirectCostDetails indirectCostDetails : periodInfo
                    .getIndirectCosts().getIndirectCostDetails()) {
                IndirectCosts.IndirectCost indirectCost = IndirectCosts.IndirectCost.Factory
                        .newInstance();
                if (indirectCostDetails.getBase() != null) {
                    indirectCost.setBase(indirectCostDetails.getBase()
                            .bigDecimalValue());
                }
                indirectCost.setCostType(indirectCostDetails.getCostType());
                if (indirectCostDetails.getFunds() != null) {
                    indirectCost.setFundRequested(indirectCostDetails
                            .getFunds().bigDecimalValue());
                }
                if (indirectCostDetails.getRate() != null) {
                    indirectCost.setRate(indirectCostDetails.getRate()
                            .bigDecimalValue());
                }
                indirectCostList.add(indirectCost);
                IndirectCostCount++;
                if (IndirectCostCount == ARRAY_LIMIT_IN_SCHEMA) {
                    LOG
                            .warn("Stopping iteration over indirect cost details because array limit in schema is only 4");
                    break;
                }
            }
            if (IndirectCostCount > 0) {
                indirectCosts = IndirectCosts.Factory.newInstance();
                IndirectCosts.IndirectCost indirectCostArray[] = new IndirectCosts.IndirectCost[0];
                indirectCosts.setIndirectCostArray(indirectCostList
                        .toArray(indirectCostArray));
                if (periodInfo.getIndirectCosts().getTotalIndirectCosts() != null) {
                    indirectCosts.setTotalIndirectCosts(periodInfo
                            .getIndirectCosts().getTotalIndirectCosts()
                            .bigDecimalValue());
                }
            }
        }
        return indirectCosts;
    }

    /**
     * This method is to set Other type description and total cost
     * OtherDirectCosts details in BudgetYearDataType based on BudgetPeriodInfo
     * for the RRBudget10.
     *
     * @param OtherDirectCosts otherDirectCosts xmlObject
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     */
    private void setOthersForOtherDirectCosts(OtherDirectCosts otherDirectCosts, BudgetPeriodInfo periodInfo) {
        if (periodInfo != null && periodInfo.getOtherDirectCosts() != null) {
            for (OtherDirectCostInfo otherDirectCostInfo : periodInfo.getOtherDirectCosts()) {
                gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherDirectCosts.Other other = otherDirectCosts.addNewOther();
                if (otherDirectCostInfo.getOtherCosts() != null
                        && otherDirectCostInfo.getOtherCosts().size() > 0) {
                    other
                            .setCost(new BigDecimal(otherDirectCostInfo
                                    .getOtherCosts().get(0).get(
                                            S2SConstants.KEY_COST)));
                }
                other.setDescription(OTHERCOST_DESCRIPTION);
            }
        }
    }

    /**
     * This method gets Travel cost information including
     * DomesticTravelCost,ForeignTravelCost and TotalTravelCost in the
     * BudgetYearDataType based on BudgetPeriodInfo for the RRBudget10.
     *
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     * @return Travel costs corresponding to the BudgetPeriodInfo object.
     */
    private Travel getTravel(BudgetPeriodInfo periodInfo) {

        Travel travel = Travel.Factory.newInstance();
        if (periodInfo != null) {
            travel.setDomesticTravelCost(periodInfo.getDomesticTravelCost()
                    .bigDecimalValue());
            travel.setForeignTravelCost(periodInfo.getForeignTravelCost()
                    .bigDecimalValue());
            travel.setTotalTravelCost(periodInfo.getTotalTravelCost()
                    .bigDecimalValue());
        }
        return travel;
    }

    /**
     * This method gets Equipment details such as
     * EquipmentItem,FundsRequested,TotalFundForAttachedEquipment, TotalFund and
     * AdditionalEquipmentsAttachment based on BudgetPeriodInfo for the
     * RRBudget10.
     *
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     * @return Equipment costs corresponding to the BudgetPeriodInfo object.
     *
     */
    private Equipment getEquipment(BudgetPeriodInfo periodInfo) {
        Equipment equipment = Equipment.Factory.newInstance();
        Narrative extraEquipmentNarr = null;
        if (periodInfo != null && periodInfo.getEquipment() != null
                && periodInfo.getEquipment().size() > 0) {
            // Evaluating Equipments.
            List<EquipmentList> equipmentArrayList = new ArrayList<EquipmentList>();
            BudgetDecimal totalFund = BudgetDecimal.ZERO;
            for (CostInfo costInfo : periodInfo.getEquipment().get(0)
                    .getEquipmentList()) {
                EquipmentList equipmentList = EquipmentList.Factory.newInstance();
                equipmentList.setEquipmentItem(costInfo.getDescription());
                if (costInfo.getCost() != null) {
                    equipmentList.setFundsRequested(costInfo.getCost().bigDecimalValue());
                }
                totalFund = totalFund.add(costInfo.getCost());
                equipmentArrayList.add(equipmentList);
            }

            // Evaluating Extra Equipments.
            List<CostInfo> extraEquipmentArrayList = new ArrayList<CostInfo>();
            BudgetDecimal totalExtraEquipFund = BudgetDecimal.ZERO;
            for(CostInfo costInfo:periodInfo.getEquipment().get(0).getExtraEquipmentList()){
                extraEquipmentArrayList.add(costInfo);
                totalExtraEquipFund = totalExtraEquipFund.add(costInfo.getCost());
            }
            EquipmentList[] equipmentArray = new EquipmentList[0];
            equipmentArray = equipmentArrayList.toArray(equipmentArray);
            equipment.setEquipmentListArray(equipmentArray);
            totalFund = totalFund.add(totalExtraEquipFund);
            equipment.setTotalFund(totalFund.bigDecimalValue());
            if (equipmentArray.length > 0) {
                equipment.setTotalFundForAttachedEquipment(totalExtraEquipFund.bigDecimalValue());
            }
            extraEquipmentNarr = saveAdditionalEquipments(periodInfo,extraEquipmentArrayList);
        }
        if(extraEquipmentNarr!=null){
            AttachedFileDataType equipmentAttachment = AttachedFileDataType.Factory.newInstance();
            FileLocation fileLocation = FileLocation.Factory.newInstance();
            equipmentAttachment.setFileLocation(fileLocation);
            String contentId = createContentId(extraEquipmentNarr);
            fileLocation.setHref(contentId);
            equipmentAttachment.setFileLocation(fileLocation);
            equipmentAttachment.setFileName(extraEquipmentNarr.getFileName());
            equipmentAttachment
                    .setMimeType(S2SConstants.CONTENT_TYPE_OCTET_STREAM);
            extraEquipmentNarr.refreshReferenceObject(NARRATIVE_ATTACHMENT_LIST);
            if (extraEquipmentNarr.getNarrativeAttachmentList() != null
                    && extraEquipmentNarr.getNarrativeAttachmentList().size() > 0) {
                equipmentAttachment.setHashValue(getHashValue(extraEquipmentNarr
                        .getNarrativeAttachmentList().get(0).getContent()));
            }
            AttachmentData attachmentData = new AttachmentData();
            attachmentData.setContent(extraEquipmentNarr
                    .getNarrativeAttachmentList().get(0).getContent());
            attachmentData.setContentId(contentId);
            attachmentData.setContentType(S2SConstants.CONTENT_TYPE_OCTET_STREAM);
            attachmentData.setFileName(extraEquipmentNarr.getFileName());
            addAttachment(attachmentData);
            equipment.setAdditionalEquipmentsAttachment(equipmentAttachment);
        }
        return equipment;
    }

    /**
     * This method gets OtherPersonnel informations like
     * PostDocAssociates,GraduateStudents,UndergraduateStudents
     * SecretarialClerical based on PersonnelType and also gets
     * NumberOfPersonnel, ProjectRole,Compensation OtherPersonnelTotalNumber and
     * TotalOtherPersonnelFund based on BudgetPeriodInfo for the RRBudget10.
     *
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     * @return OtherPersonnel details corresponding to the BudgetPeriodInfo
     *         object.
     */
    private OtherPersonnel getOtherPersonnel(BudgetPeriodInfo periodInfo) {
        OtherPersonnel otherPersonnel = OtherPersonnel.Factory.newInstance();
        int otherPersonnelCount = 0;
        List<gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherPersonnel.Other> otherPersonnelList = new ArrayList<gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherPersonnel.Other>();
        gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherPersonnel.Other otherPersonnelDataTypeArray[] = new gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherPersonnel.Other[1];
        if (periodInfo != null) {
            for (OtherPersonnelInfo otherPersonnelInfo : periodInfo
                    .getOtherPersonnel()) {

                if (OTHERPERSONNEL_POSTDOC.equals(otherPersonnelInfo
                        .getPersonnelType())) {
                    otherPersonnel
                            .setPostDocAssociates(getPostDocAssociates(otherPersonnelInfo));
                } else if (OTHERPERSONNEL_GRADUATE.equals(otherPersonnelInfo
                        .getPersonnelType())) {
                    otherPersonnel
                            .setGraduateStudents(getGraduateStudents(otherPersonnelInfo));
                } else if (OTHERPERSONNEL_UNDERGRADUATE
                        .equals(otherPersonnelInfo.getPersonnelType())) {
                    otherPersonnel
                            .setUndergraduateStudents(getUndergraduateStudents(otherPersonnelInfo));
                } else if (OTHERPERSONNEL_SECRETARIAL.equals(otherPersonnelInfo
                        .getPersonnelType())) {
                    otherPersonnel.setSecretarialClerical(getSecretarialClerical(otherPersonnelInfo));
                } else if (otherPersonnelCount < OTHERPERSONNEL_MAX_ALLOWED) {// Max
                    // allowed
                    // is 6
                    CompensationInfo sectBCompType = otherPersonnelInfo.getCompensation();
                    gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherPersonnel.Other otherPersonnelDataType = otherPersonnel.addNewOther();
                    otherPersonnelDataType.setNumberOfPersonnel(otherPersonnelInfo.getNumberPersonnel());
                    otherPersonnelDataType.setProjectRole(otherPersonnelInfo.getRole());
                    otherPersonnelDataType.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue());
                    otherPersonnelDataType.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue());
                    otherPersonnelDataType.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue());
                    otherPersonnelDataType.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue());
                    otherPersonnelDataType.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue());
                    otherPersonnelDataType.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue());
                    otherPersonnelList.add(otherPersonnelDataType);
                    otherPersonnelCount++;
                }
            }
            otherPersonnelDataTypeArray = otherPersonnelList.toArray(otherPersonnelDataTypeArray);
            otherPersonnel.setOtherArray(otherPersonnelDataTypeArray);

            if (periodInfo.getOtherPersonnelTotalNumber() != null) {
                otherPersonnel.setOtherPersonnelTotalNumber(periodInfo
                        .getOtherPersonnelTotalNumber().intValue());
            }
            if (periodInfo.getTotalOtherPersonnelFunds() != null) {
                otherPersonnel.setTotalOtherPersonnelFund(periodInfo
                        .getTotalOtherPersonnelFunds().bigDecimalValue());
            }
        }
        return otherPersonnel;
    }

    /**
     * This method gets the PostDocAssociates details,ProjectRole,
     * NumberOfPersonnel,Compensation based on OtherPersonnelInfo for the
     * RRBudget10,if it is a PostDocAssociates type.
     *
     * @param otherPersonnel
     *            (OtherPersonnelInfo)other personnel info entry.
     * @return PostDocAssociates details corresponding to the OtherPersonnelInfo
     *         object.
     */
    private PostDocAssociates getPostDocAssociates(
            OtherPersonnelInfo otherPersonnel) {

        PostDocAssociates postDocAssociates = PostDocAssociates.Factory
                .newInstance();
        if (otherPersonnel != null) {
            postDocAssociates.setNumberOfPersonnel(otherPersonnel
                    .getNumberPersonnel());
            postDocAssociates.setProjectRole(otherPersonnel.getRole());
            CompensationInfo sectBCompType = otherPersonnel.getCompensation();

            postDocAssociates.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue());
            postDocAssociates.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue());
            postDocAssociates.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue());
            postDocAssociates.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue());
            postDocAssociates.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue());
            postDocAssociates.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue());

        }
        return postDocAssociates;
    }

    /**
     * This method gets the GraduateStudents details,ProjectRole,
     * NumberOfPersonnel,Compensation based on OtherPersonnelInfo for the
     * RRBudget10, if it is a GraduateStudents type.
     *
     * @param otherPersonnel
     *            (OtherPersonnelInfo) other personnel info entry.
     * @return GraduateStudents details corresponding to the OtherPersonnelInfo
     *         object.
     */
    private GraduateStudents getGraduateStudents(
            OtherPersonnelInfo otherPersonnel) {

        GraduateStudents graduate = GraduateStudents.Factory.newInstance();
        if (otherPersonnel != null) {
            graduate.setNumberOfPersonnel(otherPersonnel.getNumberPersonnel());
            graduate.setProjectRole(otherPersonnel.getRole());
            CompensationInfo sectBCompType = otherPersonnel.getCompensation();

            graduate.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue());
            graduate.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue());
            graduate.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue());
            graduate.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue());
            graduate.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue());
            graduate.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue());

        }
        return graduate;
    }

    /**
     * This method is to get the UndergraduateStudents details,ProjectRole,
     * NumberOfPersonnel,Compensation based on OtherPersonnelInfo for the
     * RRBudget10,if it is a UndergraduateStudents type.
     *
     * @param otherPersonnel
     *            (OtherPersonnelInfo) other personnel info entry.
     * @return UndergraduateStudents details corresponding to the
     *         OtherPersonnelInfo object.
     */
    private UndergraduateStudents getUndergraduateStudents(
            OtherPersonnelInfo otherPersonnel) {

        UndergraduateStudents undergraduate = UndergraduateStudents.Factory
                .newInstance();
        if (otherPersonnel != null) {
            undergraduate.setNumberOfPersonnel(otherPersonnel
                    .getNumberPersonnel());
            undergraduate.setProjectRole(otherPersonnel.getRole());
            CompensationInfo sectBCompType = otherPersonnel.getCompensation();

            undergraduate.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue());
            undergraduate.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue());
            undergraduate.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue());
            undergraduate.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue());
            undergraduate.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue());
            undergraduate.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue());

        }
        return undergraduate;
    }

    /**
     * This method is to get the SecretarialClerical details,ProjectRole,
     * NumberOfPersonnel,Compensation based on OtherPersonnelInfo for the
     * RRBudget10,if it is a SecretarialClerical type.
     *
     * @param otherPersonnel
     *            (OtherPersonnelInfo) other personnel info entry.
     * @return SecretarialClerical corresponding to the OtherPersonnelInfo
     *         object.
     */
    private SecretarialClerical getSecretarialClerical(
            OtherPersonnelInfo otherPersonnel) {

        SecretarialClerical secretarialClerical = SecretarialClerical.Factory
                .newInstance();
        if (otherPersonnel != null) {
            secretarialClerical.setNumberOfPersonnel(otherPersonnel
                    .getNumberPersonnel());
            secretarialClerical.setProjectRole(otherPersonnel.getRole());
            CompensationInfo sectBCompType = otherPersonnel.getCompensation();

            secretarialClerical.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue());
            secretarialClerical.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue());
            secretarialClerical.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue());
            secretarialClerical.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue());
            secretarialClerical.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue());
            secretarialClerical.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue());

        }
        return secretarialClerical;
    }

    /**
     * This method gets KeyPersons details such as
     * Name,ProjectRole,Compensation,TotalFundForAttachedKeyPersons
     * TotalFundForKeyPersons and AttachedKeyPersons based on BudgetPeriodInfo
     * for the RRBudget10.
     *
     * @param periodInfo
     *            (BudgetPeriodInfo) budget period entry.
     * @return KeyPersons details corresponding to the BudgetPeriodInfo object.
     */
    private KeyPersons getKeyPersons(BudgetPeriodInfo periodInfo) {

        KeyPersons keyPersons = KeyPersons.Factory.newInstance();
        BudgetDecimal extraFunds = BudgetDecimal.ZERO;
        BudgetService budgetService = KraServiceLocator.getService(BudgetService.class);
        BudgetDecimal baseSalaryByPeriod;

        if (periodInfo != null) {
            if (periodInfo.getKeyPersons() != null) {
                List<KeyPerson> keyPersonList = new ArrayList<KeyPerson>();
                int keyPersonCount = 0;
                for (KeyPersonInfo keyPerson : periodInfo.getKeyPersons()) {
                  if(keyPerson.getRole().equals(NID_PD_PI) || hasPersonnelBudget(keyPerson,periodInfo.getBudgetPeriod())){
                    KeyPerson keyPersonDataType = KeyPerson.Factory.newInstance();
                    keyPersonDataType.setName(globLibV20Generator
                            .getHumanNameDataType(keyPerson));
                    if (isSponsorNIH(pdDoc)
                            && KEYPERSON_CO_PD_PI.equals(keyPerson.getRole())) {
                        DevelopmentProposal developmentProposal=pdDoc.getDevelopmentProposal();

                        for (ProposalPerson proposalPerson : developmentProposal.getInvestigators()) {
                            if(isProposalPersonEqualsKeyPerson(proposalPerson, keyPerson)){
                                if(proposalPerson.isMultiplePi())
                                    keyPersonDataType.setProjectRole(NID_PD_PI);
                                else
                                    keyPersonDataType.setProjectRole(NID_CO_PD_PI);
                            }
                        }
                    } else if(keyPerson.getKeyPersonRole()!=null){
                        keyPersonDataType.setProjectRole(keyPerson.getKeyPersonRole());
                    } else {
                        keyPersonDataType.setProjectRole(keyPerson.getRole());
                    }
                        if (pdDoc.getBudgetDocumentVersions() != null) {
                            baseSalaryByPeriod = budgetService.getBaseSalaryByPeriod(pdDoc.getBudgetDocumentVersion(0)
                                    .getBudgetVersionOverview().getBudgetId(), periodInfo.getBudgetPeriod(), keyPerson);
                            if (baseSalaryByPeriod != null) {
                                keyPersonDataType.setBaseSalary(baseSalaryByPeriod.bigDecimalValue());
                            }
                            else {
                                if (keyPerson.getBaseSalary() != null) {
                                    keyPersonDataType.setBaseSalary(keyPerson.getBaseSalary().bigDecimalValue());
                                }
                            }

                        }
                        else {
                            if (keyPerson.getBaseSalary() != null) {
                                keyPersonDataType.setBaseSalary(keyPerson.getBaseSalary().bigDecimalValue());
                            }
                        }
                    keyPersonDataType.setRequestedSalary(keyPerson.getRequestedSalary().bigDecimalValue());
                    keyPersonDataType.setFringeBenefits(keyPerson.getFringe().bigDecimalValue());
                    keyPersonDataType.setAcademicMonths(keyPerson.getAcademicMonths().bigDecimalValue());
                    keyPersonDataType.setCalendarMonths(keyPerson.getCalendarMonths().bigDecimalValue());
                    keyPersonDataType.setFundsRequested(keyPerson.getFundsRequested().bigDecimalValue());
                    keyPersonDataType.setSummerMonths(keyPerson.getSummerMonths().bigDecimalValue());

                    keyPersonList.add(keyPersonDataType);
                    keyPersonCount++;
                    LOG.info("keyPersonCount:" + keyPersonCount);
                }
            }
                keyPersons.setKeyPersonArray(keyPersonList.toArray(new KeyPerson[0]));
            }
            if (periodInfo.getTotalFundsKeyPersons() != null) {
                keyPersons.setTotalFundForKeyPersons(periodInfo
                        .getTotalFundsKeyPersons().bigDecimalValue());
            }
            for (KeyPersonInfo keyPerson : periodInfo.getExtraKeyPersons()) {
                extraFunds = extraFunds.add(keyPerson.getFundsRequested());
            }
        }
        keyPersons.setTotalFundForAttachedKeyPersons(extraFunds.bigDecimalValue());
        Narrative extraKeyPersonNarr = saveExtraKeyPersons(periodInfo);
        if(extraKeyPersonNarr!=null){
            AttachedFileDataType attachedKeyPersons = AttachedFileDataType.Factory.newInstance();
            FileLocation fileLocation = FileLocation.Factory.newInstance();
            attachedKeyPersons.setFileLocation(fileLocation);
            String contentId = createContentId(extraKeyPersonNarr);
            fileLocation.setHref(contentId);
            attachedKeyPersons.setFileLocation(fileLocation);
            attachedKeyPersons.setFileName(extraKeyPersonNarr.getFileName());
            attachedKeyPersons
                    .setMimeType(S2SConstants.CONTENT_TYPE_OCTET_STREAM);
            extraKeyPersonNarr.refreshReferenceObject(NARRATIVE_ATTACHMENT_LIST);
            AttachmentData attachmentData = new AttachmentData();
            byte[] narrativeContent = null;
            if (extraKeyPersonNarr.getNarrativeAttachmentList() != null
                    && extraKeyPersonNarr.getNarrativeAttachmentList().size() > 0) {
                narrativeContent = extraKeyPersonNarr
                .getNarrativeAttachmentList().get(0).getContent();

            }
            if(narrativeContent != null && narrativeContent.length > 0){
                attachedKeyPersons.setHashValue(getHashValue(narrativeContent));
                attachmentData.setContent(narrativeContent);
                attachmentData.setContentId(contentId);
                attachmentData
                        .setContentType(S2SConstants.CONTENT_TYPE_OCTET_STREAM);
                attachmentData.setFileName(extraKeyPersonNarr.getFileName());
                addAttachment(attachmentData);
                keyPersons.setAttachedKeyPersons(attachedKeyPersons);
            }
        }
        return keyPersons;
    }

    /**
     * This method creates {@link XmlObject} of type {@link RRBudget10Document} by
     * populating data from the given {@link ProposalDevelopmentDocument}
     *
     * @param proposalDevelopmentDocument
     *            for which the {@link XmlObject} needs to be created
     * @return {@link XmlObject} which is generated using the given
     *         {@link ProposalDevelopmentDocument}
     * @see org.kuali.kra.s2s.generator.S2SFormGenerator#getFormObject(ProposalDevelopmentDocument)
     */
    public XmlObject getFormObject(
            ProposalDevelopmentDocument proposalDevelopmentDocument) {
        this.pdDoc = proposalDevelopmentDocument;
        return getRRBudget10();
    }

    /**
     * This method typecasts the given {@link XmlObject} to the required
     * generator type and returns back the document of that generator type.
     *
     * @param xmlObject
     *            which needs to be converted to the document type of the
     *            required generator
     * @return {@link XmlObject} document of the required generator type
     * @see org.kuali.kra.s2s.generator.S2SFormGenerator#getFormObject(XmlObject)
     */
    public XmlObject getFormObject(XmlObject xmlObject) {
        RRBudget10 rrBudget = (RRBudget10) xmlObject;
        RRBudget10Document rrBudgetDocument = RRBudget10Document.Factory
                .newInstance();
        rrBudgetDocument.setRRBudget10(rrBudget);
        return rrBudgetDocument;
    }
}


text:
require('../../jqwidgets/jqxcore');
require('../../jqwidgets/jqxdata');
require('../../jqwidgets/jqxbuttons');
require('../../jqwidgets/jqxscrollbar');
require('../../jqwidgets/jqxmenu');
require('../../jqwidgets/jqxwindow');
require('../../jqwidgets/jqxdragdrop');
require('../../jqwidgets/jqxcheckbox');
require('../../jqwidgets/jqxinput');
require('../../jqwidgets/jqxlistbox');
require('../../jqwidgets/jqxdropdownlist');
require('../../jqwidgets/jqxpivot');
require('../../jqwidgets/jqxpivotgrid');
require('../../jqwidgets/jqxpivotdesigner');
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
    typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
    (factory((global.react_jqxpivotgrid = {}),global.React));
}(this, (function (exports,React) { 'use strict';

    /* global Reflect, Promise */

    var extendStatics = function(d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };

    function __extends(d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    }

    var JqxPivotGrid = /** @class */ (function (_super) {
        __extends(JqxPivotGrid, _super);
        function JqxPivotGrid(props) {
            var _this = _super.call(this, props) || this;
            /* tslint:disable:variable-name */
            _this._jqx = JQXLite;
            _this._id = 'JqxPivotGrid' + _this._jqx.generateID();
            _this._componentSelector = '#' + _this._id;
            _this.state = { lastProps: props };
            return _this;
        }
        JqxPivotGrid.getDerivedStateFromProps = function (props, state) {
            if (!Object.is) {
                Object.is = function (x, y) {
                    if (x === y) {
                        return x !== 0 || 1 / x === 1 / y;
                    }
                    else {
                        return x !== x && y !== y;
                    }
                };
            }
            var areEqual = Object.is(props, state.lastProps);
            if (!areEqual) {
                var newState = { lastProps: props };
                return newState;
            }
            return null;
        };
        JqxPivotGrid.prototype.componentDidMount = function () {
            var widgetOptions = this._manageProps();
            this._jqx(this._componentSelector).jqxPivotGrid(widgetOptions);
            this._wireEvents();
        };
        JqxPivotGrid.prototype.componentDidUpdate = function () {
            var widgetOptions = this._manageProps();
            this.setOptions(widgetOptions);
            this._wireEvents();
        };
        JqxPivotGrid.prototype.render = function () {
            return (React.createElement("div", { id: this._id, className: this.props.className, style: this.props.style }, this.props.children));
        };
        JqxPivotGrid.prototype.setOptions = function (options) {
            this._jqx(this._componentSelector).jqxPivotGrid(options);
        };
        JqxPivotGrid.prototype.getOptions = function (option) {
            return this._jqx(this._componentSelector).jqxPivotGrid(option);
        };
        JqxPivotGrid.prototype.getInstance = function () {
            return this._jqx(this._componentSelector).jqxPivotGrid('getInstance');
        };
        JqxPivotGrid.prototype.refresh = function () {
            this._jqx(this._componentSelector).jqxPivotGrid('refresh');
        };
        JqxPivotGrid.prototype.getPivotRows = function () {
            return this._jqx(this._componentSelector).jqxPivotGrid('getPivotRows');
        };
        JqxPivotGrid.prototype.getPivotColumns = function () {
            return this._jqx(this._componentSelector).jqxPivotGrid('getPivotColumns');
        };
        JqxPivotGrid.prototype.getPivotCells = function () {
            return this._jqx(this._componentSelector).jqxPivotGrid('getPivotCells');
        };
        JqxPivotGrid.prototype._manageProps = function () {
            var widgetProps = ['source', 'localization', 'scrollBarsEnabled', 'selectionEnabled', 'multipleSelectionEnabled', 'treeStyleRows', 'autoResize', 'itemsRenderer', 'cellsRenderer'];
            var options = {};
            for (var prop in this.props) {
                if (widgetProps.indexOf(prop) !== -1) {
                    options[prop] = this.props[prop];
                }
            }
            return options;
        };
        JqxPivotGrid.prototype._wireEvents = function () {
            for (var prop in this.props) {
                if (prop.indexOf('on') === 0) {
                    var originalEventName = prop.slice(2);
                    originalEventName = originalEventName.charAt(0).toLowerCase() + originalEventName.slice(1);
                    this._jqx(this._componentSelector).off(originalEventName);
                    this._jqx(this._componentSelector).on(originalEventName, this.props[prop]);
                }
            }
        };
        return JqxPivotGrid;
    }(React.PureComponent));
    var jqx = window.jqx;
    var JQXLite = window.JQXLite;

    exports.default = JqxPivotGrid;
    exports.jqx = jqx;
    exports.JQXLite = JQXLite;

    Object.defineProperty(exports, '__esModule', { value: true });

})));


text:
@extends('default')

@section('title')
{{ trans('entities/volunteers.create') }}
@stop
@section('pageTitle')
{{ trans('entities/volunteers.create') }}
@stop

@section('bodyContent')

has('name') || $errors->has('last_name') || $errors->has('fathers_name') ||$errors->has('birth_date') ? 'tab has-error' : ''}}">{{ trans('entities/volunteers.personalInfo') }}

has('email') ? 'tab has-error' : ''}}">{{ trans('entities/volunteers.contactInfo') }}

{{ trans('entities/volunteers.educationAndSkills') }}

has('participation_reason') ? 'tab has-error' : ''}}">{{ trans('entities/volunteers.workAndVolunteeringExp') }}

{{ trans('entities/volunteers.availabilityAndInterests') }}

has('files[]') ? 'tab has-error' : ''}}">{{ trans('entities/volunteers.commentsAndInfo') }}

                {!! Form::open(['id' => 'wizardForm', 'method' => 'POST', 'action' => ['VolunteerController@store'], 'files'=>true]) !!}
                    @include('main.volunteers.partials._form')
                {!! Form::close() !!}

@stop