Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you write code for DLLImp.java DLLCompImp.java TimeSeriesImp.java NumericTimeSeriesImp.javaStockHistoryImp.java BST . java StockHistoryDataSetImp.java StockDataLoaderImp.java StockDataSetAnalyzerImp.java Without using java collection or any data structure library 2

Could you write code for
DLLImp.java
DLLCompImp.java
TimeSeriesImp.java NumericTimeSeriesImp.javaStockHistoryImp.java
BST.java StockHistoryDataSetImp.java
StockDataLoaderImp.java StockDataSetAnalyzerImp.java
Without using java collection or any data structurelibrary
2.1 InterfaceDLL
This isthe interfaceofadoublylinkedlistseeninclass, augmentedwiththemethodsize. Implementthis
interfaceintheclassDLLImp.
// Interface representing a doubly linked list.
public interface DLL {
// Returns the number of elements in the list.
int size();
// Returns true if the list is empty, false otherwise.
boolean empty();
// Returns true if the current position is at the last element, false otherwise.
boolean last();
// Returns true if the current position is at the first element, false
// otherwise.
boolean first();
// Sets the current position to the first element of the list (detailed
// specification seen in class).
void findFirst();
// Advances the current position to the next element in the list (detailed
// specification seen in class).
void findNext();
// Moves the current position to the previous element in the list (detailed
// specification seen in class).
void findPrevious();
// Retrieves the element at the current position.
T retrieve();
// Updates the element at the current position with the provided value.
void update(T val);
// Inserts the provided element at the current position in the list (detailed
// specification seen in class).
void insert(T val);
// Removes the element at the current position from the list (detailed
// specification seen in class).
void remove();
}
2.2 InterfaceDLLComp
This is the interfaceof adoubly linked listwithcomparabledata. Implement this interface inthe class
DLLCompImp[RequiresChapteronSorting].
// A DLL where data is comparable.
public interface DLLComp> extends DLL {
//[Requires Chapter on Sorting] Sorts the list. The parameter "increasing"
// indicates whether the sort is done in increasing or decreasing order.
void sort(boolean increasing);
// Returns the maximum element. The list must not be empty.
T getMax();
// Returns the maximum element. The list must not be empty.
T getMin();
}
2.3 ClassPair
Agenericclassusedtostoreapairofobjects(donotmodify).
// Class used to store a pair of elements.
public class Pair {
public U first;
CSC212 Project
4
public V second;
public Pair(U first, V second){
this.first = first;
this.second = second;
}
@Override
public String toString(){
return first.toString()+","+ second.toString();
}
}
2.4 ClassCompPair
Agenericclassusedtostoreapairofobjects.Thepairiscomparableonthesecondelement(donotmodify).
// Class used to store a pair of elements that is comparable on the second element.
public class CompPair> extends Pair implements Comparable
CompPair>{
public CompPair(U first, V second){
super(first, second);
}
@Override
public int compareTo(CompPair other){
return this.second.compareTo(other.second);
}
}
2.5 ClassDataPoint
Agenericclassthatrepresentsadatapoint(donotmodify).
import java.text.SimpleDateFormat;
import java.util.Date;
// Represents a single data point in a time series. Each data point consists of a date and
a corresponding value.
public class DataPoint {
// The date of the data point.
public Date date;
// The value of the data point.
public T value;
public DataPoint(Date date, T value){
this.date = date;
this.value = value;
}
@Override
public String toString(){
SimpleDateFormat dateFormat = newSimpleDateFormat("yyyy-MM-dd");
return dateFormat.format(date)+":"+ value.toString();
}
}
2.6 InterfaceTimeSeries
Agenericinterfacethatrepresentsatimeseries. ImplementthisinterfaceintheclassTimeSeriesImp.
import java.util.Date;
// Interface representing a time series of data points.
public interface TimeSeries {
// Returns the number of elements in the time series.
int size();
// Returns true if the time series is empty, false otherwise.
2.11 Interface StockHistoryDataSet
An interface that represents the stock histories of several companies. Implement this interface in the class
Sto boolean empty();
// Retrieves the data corresponding to a specific date. This method returns the
// data point for the specified date, or null if no such data point exists.
T getDataPoint(Date date);
// Return all dates in increasing order.
DLL getAllDates();
// Returns min date. Time series must not be empty.
Date getMinDate();
// Returns max date. Time series must not be empty.
Date getMaxDate();
// Adds a new data point to the time series. If successful, the method returns
// true. If date already exists, the method returns false.
boolean addDataPoint(DataPoint dataPoint);
// Updates a data point. This method returns true if the date exists and the
// update was successful, false otherwise.
boolean updateDataPoint(DataPoint dataPoin
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions