code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Override
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) {
// Switch the current policy and compilation result for this unit to the requested one.
CompilationResult unitResult =
new CompilationResult(sourceUnit, this.totalUnits, this.totalUnits, this... | java |
@Override
public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding, AccessRestriction accessRestriction) {
this.problemReporter.abortDueToInternalError(
Messages.bind(Messages.abort_againstSourceModel, new String[] { String.valueOf(sourceTypes[0].getName()), String.valueOf(sou... | java |
protected void reportProgress(String taskDecription) {
if (this.progress != null) {
if (this.progress.isCanceled()) {
// Only AbortCompilation can stop the compiler cleanly.
// We check cancellation again following the call to compile.
throw new AbortC... | java |
protected void reportWorked(int workIncrement, int currentUnitIndex) {
if (this.progress != null) {
if (this.progress.isCanceled()) {
// Only AbortCompilation can stop the compiler cleanly.
// We check cancellation again following the call to compile.
... | java |
private void compile(ICompilationUnit[] sourceUnits, boolean lastRound) {
this.stats.startTime = System.currentTimeMillis();
try {
// build and record parsed units
reportProgress(Messages.compilation_beginningToCompile);
if (this.options.complianceLevel >= ClassFileC... | java |
public void process(CompilationUnitDeclaration unit, int i) {
this.lookupEnvironment.unitBeingCompleted = unit;
long parseStart = System.currentTimeMillis();
this.parser.getMethodBodies(unit);
long resolveStart = System.currentTimeMillis();
this.stats.parseTime += resolveStart ... | java |
@PostConstruct
public void loadTagDefinitions()
{
Map<Addon, List<URL>> addonToResourcesMap = scanner.scanForAddonMap(new FileExtensionFilter("tags.xml"));
for (Map.Entry<Addon, List<URL>> entry : addonToResourcesMap.entrySet())
{
for (URL resource : entry.getValue())
... | java |
public static BatchASTFuture analyze(final BatchASTListener listener, final WildcardImportResolver importResolver,
final Set<String> libraryPaths,
final Set<String> sourcePaths, Set<Path> sourceFiles)
{
final String[] encodings = null;
final String[] bindingKeys = ne... | java |
public AnnotationTypeCondition addCondition(String element, AnnotationCondition condition)
{
this.conditions.put(element, condition);
return this;
} | java |
@Override
public DecompilationResult decompileClassFile(Path rootDir, Path classFilePath, Path outputDir)
throws DecompilationException
{
Checks.checkDirectoryToBeRead(rootDir.toFile(), "Classes root dir");
File classFile = classFilePath.toFile();
Checks.checkFileToBeRead... | java |
private void refreshMetadataCache(final Queue<WindupMetadataSystem> metadataSystemCache, final DecompilerSettings settings)
{
metadataSystemCache.clear();
for (int i = 0; i < this.getNumberOfThreads(); i++)
{
metadataSystemCache.add(new NoRetryMetadataSystem(settings.getTypeLoade... | java |
private File decompileType(final DecompilerSettings settings, final WindupMetadataSystem metadataSystem, final String typeName) throws IOException
{
log.fine("Decompiling " + typeName);
final TypeReference type;
// Hack to get around classes whose descriptors clash with primitive types.
... | java |
private DecompilerSettings getDefaultSettings(File outputDir)
{
DecompilerSettings settings = new DecompilerSettings();
procyonConf.setDecompilerSettings(settings);
settings.setOutputDirectory(outputDir.getPath());
settings.setShowSyntheticMembers(false);
settings.setForceExp... | java |
private JarFile loadJar(File archive) throws DecompilationException
{
try
{
return new JarFile(archive);
}
catch (IOException ex)
{
throw new DecompilationException("Can't load .jar: " + archive.getPath(), ex);
}
} | java |
private static synchronized FileOutputWriter createFileWriter(final TypeDefinition type, final DecompilerSettings settings)
throws IOException
{
final String outputDirectory = settings.getOutputDirectory();
final String fileName = type.getName() + settings.getLanguage().getFileExten... | java |
protected static void printValuesSorted(String message, Set<String> values)
{
System.out.println();
System.out.println(message + ":");
List<String> sorted = new ArrayList<>(values);
Collections.sort(sorted);
for (String value : sorted)
{
System.out.println... | java |
public static String getTypeValue(Class<? extends WindupFrame> clazz)
{
TypeValue typeValueAnnotation = clazz.getAnnotation(TypeValue.class);
if (typeValueAnnotation == null)
throw new IllegalArgumentException("Class " + clazz.getCanonicalName() + " lacks a @TypeValue annotation");
... | java |
public static Configuration getDefaultFreemarkerConfiguration()
{
freemarker.template.Configuration configuration = new freemarker.template.Configuration(Configuration.VERSION_2_3_26);
DefaultObjectWrapperBuilder objectWrapperBuilder = new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_26);
... | java |
public static Map<String, Object> findFreeMarkerContextVariables(Variables variables, String... varNames)
{
Map<String, Object> results = new HashMap<>();
for (String varName : varNames)
{
WindupVertexFrame payload = null;
try
{
payload = ... | java |
public ClassificationModel attachLink(ClassificationModel classificationModel, LinkModel linkModel)
{
for (LinkModel existing : classificationModel.getLinks())
{
if (StringUtils.equals(existing.getLink(), linkModel.getLink()))
{
return classificationModel;
... | java |
private MavenProjectModel getMavenStubProject(MavenProjectService mavenProjectService, String groupId, String artifactId, String version)
{
Iterable<MavenProjectModel> mavenProjectModels = mavenProjectService.findByGroupArtifactVersion(groupId, artifactId, version);
if (!mavenProjectModels.iterator(... | java |
public static Path getRootFolderForSource(Path sourceFilePath, String packageName)
{
if (packageName == null || packageName.trim().isEmpty())
{
return sourceFilePath.getParent();
}
String[] packageNameComponents = packageName.split("\\.");
Path currentPath = sourc... | java |
public static boolean isInSubDirectory(File dir, File file)
{
if (file == null)
return false;
if (file.equals(dir))
return true;
return isInSubDirectory(dir, file.getParentFile());
} | java |
public static void createDirectory(Path dir, String dirDesc)
{
try
{
Files.createDirectories(dir);
}
catch (IOException ex)
{
throw new WindupException("Error creating " + dirDesc + " folder: " + dir.toString() + " due to: " + ex.getMessage(), ex);
... | java |
private ClassReference processType(Type type, TypeReferenceLocation typeReferenceLocation, int lineNumber, int columnNumber, int length,
String line)
{
if (type == null)
return null;
ITypeBinding resolveBinding = type.resolveBinding();
if (resolveBinding == null)... | java |
private void addAnnotationValues(ClassReference annotatedReference, AnnotationClassReference typeRef, Annotation node)
{
Map<String, AnnotationValue> annotationValueMap = new HashMap<>();
if (node instanceof SingleMemberAnnotation)
{
SingleMemberAnnotation singleMemberAnnotation ... | java |
@Override
public boolean visit(VariableDeclarationStatement node)
{
for (int i = 0; i < node.fragments().size(); ++i)
{
String nodeType = node.getType().toString();
VariableDeclarationFragment frag = (VariableDeclarationFragment) node.fragments().get(i);
state... | java |
@Override
public QueryBuilderFind excludingType(final Class<? extends WindupVertexFrame> type)
{
pipelineCriteria.add(new QueryGremlinCriterion()
{
@Override
public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline)
{
pipeline.f... | java |
private boolean addonDependsOnReporting(Addon addon)
{
for (AddonDependency dep : addon.getDependencies())
{
if (dep.getDependency().equals(this.addon))
{
return true;
}
boolean subDep = addonDependsOnReporting(dep.getDependency());
... | java |
public static TagModel getSingleParent(TagModel tag)
{
final Iterator<TagModel> parents = tag.getDesignatedByTags().iterator();
if (!parents.hasNext())
throw new WindupException("Tag is not designated by any tags: " + tag);
final TagModel maybeOnlyParent = parents.next();
... | java |
public static GraphTraversal<Vertex, Vertex> addPipeFor(GraphTraversal<Vertex, Vertex> pipeline,
Class<? extends WindupVertexFrame> clazz)
{
pipeline.has(WindupVertexFrame.TYPE_PROP, GraphTypeManager.getTypeValue(clazz));
return pipeline;
} | java |
public static boolean strictCheckMatchingTags(Collection<String> tags, Set<String> includeTags, Set<String> excludeTags)
{
boolean includeTagsEnabled = !includeTags.isEmpty();
for (String tag : tags)
{
boolean isIncluded = includeTags.contains(tag);
boolean isExclude... | java |
private static List<Path> expandMultiAppInputDirs(List<Path> input)
{
List<Path> expanded = new LinkedList<>();
for (Path path : input)
{
if (Files.isRegularFile(path))
{
expanded.add(path);
continue;
}
if (!File... | java |
public static String ruleToRuleContentsString(Rule originalRule, int indentLevel)
{
if (originalRule instanceof Context && ((Context) originalRule).containsKey(RuleMetadataType.RULE_XML))
{
return (String) ((Context) originalRule).get(RuleMetadataType.RULE_XML);
}
if (!(... | java |
@Override
public <E> DynamicType.Builder<E> processMethod(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation)
{
String methodName = method.getName();
if (ReflectionUtility.isGetMethod(method))
return createInterceptor(builder, method);
else... | java |
public void associateTypeJndiResource(JNDIResourceModel resource, String type)
{
if (type == null || resource == null)
{
return;
}
if (StringUtils.equals(type, "javax.sql.DataSource") && !(resource instanceof DataSourceModel))
{
DataSourceModel ds = G... | java |
private boolean addDeploymentTypeBasedDependencies(ProjectModel projectModel, Pom modulePom)
{
if (projectModel.getProjectType() == null)
return true;
switch (projectModel.getProjectType()){
case "ear":
break;
case "war":
modulePom.... | java |
public void readTags(InputStream tagsXML)
{
SAXParserFactory factory = SAXParserFactory.newInstance();
try
{
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(tagsXML, new TagsSaxHandler(this));
}
catch (ParserConfigurationException | SAXEx... | java |
public List<Tag> getPrimeTags()
{
return this.definedTags.values().stream()
.filter(Tag::isPrime)
.collect(Collectors.toList());
} | java |
public List<Tag> getRootTags()
{
return this.definedTags.values().stream()
.filter(Tag::isRoot)
.collect(Collectors.toList());
} | java |
public Set<Tag> getAncestorTags(Tag tag)
{
Set<Tag> ancestors = new HashSet<>();
getAncestorTags(tag, ancestors);
return ancestors;
} | java |
public void writeTagsToJavaScript(Writer writer) throws IOException
{
writer.append("function fillTagService(tagService) {\n");
writer.append("\t// (name, isPrime, isPseudo, color), [parent tags]\n");
for (Tag tag : definedTags.values())
{
writer.append("\ttagService.regi... | java |
public Path getReportDirectory()
{
WindupConfigurationModel cfg = WindupConfigurationService.getConfigurationModel(getGraphContext());
Path path = cfg.getOutputPath().asFile().toPath().resolve(REPORTS_DIR);
createDirectoryIfNeeded(path);
return path.toAbsolutePath();
} | java |
@SuppressWarnings("unchecked")
public <T extends ReportModel> T getReportByName(String name, Class<T> clazz)
{
WindupVertexFrame model = this.getUniqueByProperty(ReportModel.REPORT_NAME, name);
try
{
return (T) model;
}
catch (ClassCastException ex)
{
... | java |
public String getUniqueFilename(String baseFileName, String extension, boolean cleanBaseFileName, String... ancestorFolders)
{
if (cleanBaseFileName)
{
baseFileName = PathUtil.cleanFileName(baseFileName);
}
if (ancestorFolders != null)
{
Path pathToFi... | java |
public TagSetModel getOrCreate(GraphRewrite event, Set<String> tags)
{
Map<Set<String>, Vertex> cache = getCache(event);
Vertex vertex = cache.get(tags);
if (vertex == null)
{
TagSetModel model = create();
model.setTags(tags);
cache.put(tags, model... | java |
private static Set<ProjectModel> getAllApplications(GraphContext graphContext)
{
Set<ProjectModel> apps = new HashSet<>();
Iterable<ProjectModel> appProjects = graphContext.findAll(ProjectModel.class);
for (ProjectModel appProject : appProjects)
apps.add(appProject);
retu... | java |
private static TechReportPlacement processPlaceLabels(GraphContext graphContext, Set<String> tagNames)
{
TagGraphService tagService = new TagGraphService(graphContext);
if (tagNames.size() < 3)
throw new WindupException("There should always be exactly 3 placement labels - row, sector, c... | java |
public static Artifact withVersion(Version v)
{
Artifact artifact = new Artifact();
artifact.version = v;
return artifact;
} | java |
public static Artifact withGroupId(String groupId)
{
Artifact artifact = new Artifact();
artifact.groupId = new RegexParameterizedPatternParser(groupId);
return artifact;
} | java |
public static Artifact withArtifactId(String artifactId)
{
Artifact artifact = new Artifact();
artifact.artifactId = new RegexParameterizedPatternParser(artifactId);
return artifact;
} | java |
public void setSingletonVariable(String name, WindupVertexFrame frame)
{
setVariable(name, Collections.singletonList(frame));
} | java |
public void setVariable(String name, Iterable<? extends WindupVertexFrame> frames)
{
Map<String, Iterable<? extends WindupVertexFrame>> frame = peek();
if (!Iteration.DEFAULT_VARIABLE_LIST_STRING.equals(name) && findVariable(name) != null)
{
throw new IllegalArgumentException("Va... | java |
public void removeVariable(String name)
{
Map<String, Iterable<? extends WindupVertexFrame>> frame = peek();
frame.remove(name);
} | java |
public Iterable<? extends WindupVertexFrame> findVariable(String name, int maxDepth)
{
int currentDepth = 0;
Iterable<? extends WindupVertexFrame> result = null;
for (Map<String, Iterable<? extends WindupVertexFrame>> frame : deque)
{
result = frame.get(name);
... | java |
@SuppressWarnings("unchecked")
public <T extends WindupVertexFrame> Iterable<T> findVariableOfType(Class<T> type)
{
for (Map<String, Iterable<? extends WindupVertexFrame>> topOfStack : deque)
{
for (Iterable<? extends WindupVertexFrame> frames : topOfStack.values())
{
... | java |
protected void checkVariableName(GraphRewrite event, EvaluationContext context)
{
if (getInputVariablesName() == null)
{
setInputVariablesName(Iteration.getPayloadVariableName(event, context));
}
} | java |
private static Map<String, Integer> findClasses(Path path)
{
List<String> paths = findPaths(path, true);
Map<String, Integer> results = new HashMap<>();
for (String subPath : paths)
{
if (subPath.endsWith(".java") || subPath.endsWith(".class"))
{
... | java |
public Path getTransformedXSLTPath(FileModel payload)
{
ReportService reportService = new ReportService(getGraphContext());
Path outputPath = reportService.getReportDirectory();
outputPath = outputPath.resolve(this.getRelativeTransformedXSLTPath(payload));
if (!Files.isDirectory(outp... | java |
public static String resolveDataSourceTypeFromDialect(String dialect)
{
if (StringUtils.contains(dialect, "Oracle"))
{
return "Oracle";
}
else if (StringUtils.contains(dialect, "MySQL"))
{
return "MySQL";
}
else if (StringUtils.contains... | java |
public static void load(File file)
{
try(FileInputStream inputStream = new FileInputStream(file))
{
LineIterator it = IOUtils.lineIterator(inputStream, "UTF-8");
while (it.hasNext())
{
String line = it.next();
if (!line.startsWith("... | java |
@Override
public void perform(Rewrite event, EvaluationContext context)
{
perform((GraphRewrite) event, context);
} | java |
@SafeVarargs
private final <T> Set<T> join(Set<T>... sets)
{
Set<T> result = new HashSet<>();
if (sets == null)
return result;
for (Set<T> set : sets)
{
if (set != null)
result.addAll(set);
}
return result;
} | java |
public List<IssueCategory> getIssueCategories()
{
return this.issueCategories.values().stream()
.sorted((category1, category2) -> category1.getPriority() - category2.getPriority())
.collect(Collectors.toList());
} | java |
private void addDefaults()
{
this.issueCategories.putIfAbsent(MANDATORY, new IssueCategory(MANDATORY, IssueCategoryRegistry.class.getCanonicalName(), "Mandatory", MANDATORY, 1000, true));
this.issueCategories.putIfAbsent(OPTIONAL, new IssueCategory(OPTIONAL, IssueCategoryRegistry.class.getCanonicalN... | java |
private static void renderFreemarkerTemplate(Path templatePath, Map vars, Path outputPath)
throws IOException, TemplateException
{
if(templatePath == null)
throw new WindupException("templatePath is null");
freemarker.template.Configuration freemarkerConfig = new freemarker.... | java |
public static synchronized ExecutionStatistics get()
{
Thread currentThread = Thread.currentThread();
if (stats.get(currentThread) == null)
{
stats.put(currentThread, new ExecutionStatistics());
}
return stats.get(currentThread);
} | java |
public void merge() {
Thread currentThread = Thread.currentThread();
if(!stats.get(currentThread).equals(this) || currentThread instanceof WindupChildThread) {
throw new IllegalArgumentException("Trying to merge executionstatistics from a "
+ "different thread that is... | java |
private void merge(ExecutionStatistics otherStatistics) {
for (String s : otherStatistics.executionInfo.keySet())
{
TimingData thisStats = this.executionInfo.get(s);
TimingData otherStats = otherStatistics.executionInfo.get(s);
if(thisStats == null) {
... | java |
public void serializeTimingData(Path outputPath)
{
//merge subThreads instances into the main instance
merge();
try (FileWriter fw = new FileWriter(outputPath.toFile()))
{
fw.write("Number Of Executions, Total Milliseconds, Milliseconds per execution, Type\n");
... | java |
public void begin(String key)
{
if (key == null)
{
return;
}
TimingData data = executionInfo.get(key);
if (data == null)
{
data = new TimingData(key);
executionInfo.put(key, data);
}
data.begin();
} | java |
public void end(String key)
{
if (key == null)
{
return;
}
TimingData data = executionInfo.get(key);
if (data == null)
{
LOG.info("Called end with key: " + key + " without ever calling begin");
return;
}
data.end();
... | java |
private void registerPackageInTypeInterestFactory(String pkg)
{
TypeInterestFactory.registerInterest(pkg + "_pkg", pkg.replace(".", "\\."), pkg, TypeReferenceLocation.IMPORT);
// TODO: Finish the implementation
} | java |
public static void cache(XmlFileModel key, Document document)
{
String cacheKey = getKey(key);
map.put(cacheKey, new CacheDocument(false, document));
} | java |
public static void cacheParseFailure(XmlFileModel key)
{
map.put(getKey(key), new CacheDocument(true, null));
} | java |
public static Result get(XmlFileModel key)
{
String cacheKey = getKey(key);
Result result = null;
CacheDocument reference = map.get(cacheKey);
if (reference == null)
return new Result(false, null);
if (reference.parseFailure)
return new Result(true,... | java |
public void reformatFile() throws IOException
{
List<LineNumberPosition> lineBrokenPositions = new ArrayList<>();
List<String> brokenLines = breakLines(lineBrokenPositions);
emitFormatted(brokenLines, lineBrokenPositions);
} | java |
public static PackageNameMappingWithPackagePattern fromPackage(String packagePattern)
{
PackageNameMapping packageNameMapping = new PackageNameMapping();
packageNameMapping.setPackagePattern(packagePattern);
return packageNameMapping;
} | java |
public static boolean isExclusivelyKnownArchive(GraphRewrite event, String filePath)
{
String extension = StringUtils.substringAfterLast(filePath, ".");
if (!StringUtils.equalsIgnoreCase(extension, "jar"))
return false;
ZipFile archive;
try
{
archive... | java |
private RandomVariable getShortRate(int timeIndex) throws CalculationException {
double time = getProcess().getTime(timeIndex);
double timePrev = timeIndex > 0 ? getProcess().getTime(timeIndex-1) : time;
double timeNext = getProcess().getTime(timeIndex+1);
RandomVariable zeroRate = getZeroRateFromForwardCurve(... | java |
public static double blackScholesATMOptionValue(
double volatility,
double optionMaturity,
double forward,
double payoffUnit)
{
if(optionMaturity < 0) {
return 0.0;
}
// Calculate analytic value
double dPlus = 0.5 * volatility * Math.sqrt(optionMaturity);
double dMinus = -dPlus;
double val... | java |
public static double blackScholesOptionRho(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0 || optionMaturity <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return 0.0;
}
else
... | java |
public static double blackScholesDigitalOptionValue(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return 1.0;
}
else
{
// Calcul... | java |
public static double blackScholesDigitalOptionDelta(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0 || optionMaturity <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return 0.0;
... | java |
public static double blackScholesDigitalOptionVega(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0 || optionMaturity <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return 0.0;
}... | java |
public static double blackScholesDigitalOptionRho(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionMaturity <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return 0.0;
}
else if(optionStrike ... | java |
public static double blackModelCapletValue(
double forward,
double volatility,
double optionMaturity,
double optionStrike,
double periodLength,
double discountFactor)
{
// May be interpreted as a special version of the Black-Scholes Formula
return AnalyticFormulas.blackScholesGeneralizedOptionVal... | java |
public static double blackModelDgitialCapletValue(
double forward,
double volatility,
double periodLength,
double discountFactor,
double optionMaturity,
double optionStrike)
{
// May be interpreted as a special version of the Black-Scholes Formula
return AnalyticFormulas.blackScholesDigitalOption... | java |
public static double blackModelSwaptionValue(
double forwardSwaprate,
double volatility,
double optionMaturity,
double optionStrike,
double swapAnnuity)
{
// May be interpreted as a special version of the Black-Scholes Formula
return AnalyticFormulas.blackScholesGeneralizedOptionValue(forwardSwaprat... | java |
public static double huntKennedyCMSOptionValue(
double forwardSwaprate,
double volatility,
double swapAnnuity,
double optionMaturity,
double swapMaturity,
double payoffUnit,
double optionStrike)
{
double a = 1.0/swapMaturity;
double b = (payoffUnit / swapAnnuity - a) / forwardSwaprate;
doubl... | java |
public static double huntKennedyCMSFloorValue(
double forwardSwaprate,
double volatility,
double swapAnnuity,
double optionMaturity,
double swapMaturity,
double payoffUnit,
double optionStrike)
{
double huntKennedyCMSOptionValue = huntKennedyCMSOptionValue(forwardSwaprate, volatility, swapAnnuit... | java |
public static double huntKennedyCMSAdjustedRate(
double forwardSwaprate,
double volatility,
double swapAnnuity,
double optionMaturity,
double swapMaturity,
double payoffUnit)
{
double a = 1.0/swapMaturity;
double b = (payoffUnit / swapAnnuity - a) / forwardSwaprate;
double convexityAdjustment =... | java |
public static double volatilityConversionLognormalATMtoNormalATM(double forward, double displacement, double maturity, double lognormalVolatiltiy) {
double x = lognormalVolatiltiy * Math.sqrt(maturity / 8);
double y = org.apache.commons.math3.special.Erf.erf(x);
double normalVol = Math.sqrt(2*Math.PI / maturity) ... | java |
private static InterestRateSwapLegProductDescriptor getSwapLegProductDescriptor(Element leg, String forwardCurveName, String discountCurveName,
DayCountConvention daycountConvention) {
boolean isFixed = leg.getElementsByTagName("interestType").item(0).getTextContent().equalsIgnoreCase("FIX");
ArrayList<Pe... | java |
private static AbstractIndex constructLiborIndex(String forwardCurveName, Schedule schedule) {
if(forwardCurveName != null) {
//determine average fixing offset and period length
double fixingOffset = 0;
double periodLength = 0;
for(int i = 0; i < schedule.getNumberOfPeriods(); i++) {
fixingOffset *... | java |
public RandomVariable getImpliedBachelierATMOptionVolatility(RandomVariable optionValue, double optionMaturity, double swapAnnuity){
return optionValue.average().mult(Math.sqrt(2.0 * Math.PI / optionMaturity) / swapAnnuity);
} | java |
public RandomVariable[] getBasisFunctions(double fixingDate, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
ArrayList<RandomVariable> basisFunctions = new ArrayList<>();
// Constant
RandomVariable basisFunction = new RandomVariableFromDoubleArray(1.0);//.getRandomVariableForConstant(1.... | java |
private RandomVariableInterface getDrift(int timeIndex, int componentIndex, RandomVariableInterface[] realizationAtTimeIndex, RandomVariableInterface[] realizationPredictor) {
// Check if this LIBOR is already fixed
if(getTime(timeIndex) >= this.getLiborPeriod(componentIndex)) {
return null;
}
/*
* We i... | java |
public static double getHaltonNumberForGivenBase(long index, int base) {
index += 1;
double x = 0.0;
double factor = 1.0 / base;
while(index > 0) {
x += (index % base) * factor;
factor /= base;
index /= base;
}
return x;
} | java |
public Map<Integer, RandomVariable> getGradient(){
int numberOfCalculationSteps = getFunctionList().size();
RandomVariable[] omegaHat = new RandomVariable[numberOfCalculationSteps];
omegaHat[numberOfCalculationSteps-1] = new RandomVariableFromDoubleArray(1.0);
for(int variableIndex = numberOfCalcula... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.