Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Help for Indexed-sequential file organized in Java

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 27-07-2010
Member
 
Join Date: Apr 2010
Posts: 84
Help for Indexed-sequential file organized in Java
  

I need urgent help with a project. I want an indexed-sequential file organized implement with linked index. The file should have as many sentences of any, may, from me to define structured or simple type, methods to insert a sentence, to search for and issuing a sentence, changing a sentence and to delete a sets and to output all sentences are to be developed. I want to a class that is defined in the structured data type selected by me as Element type the "file". Error cases are self-defined by intercepting exceptions. Anyone over there having any idea how to tackle it?? Please help me as soon as possible.!!

Reply With Quote
  #2  
Old 27-07-2010
Member
 
Join Date: Mar 2008
Posts: 258
Re: Help for Indexed-sequential file organized in Java

So, somehow it looks as if you had strong impact After this the only thing off, right? If I've understood all you should create a file containing the records and to have an index number. Then you do your time classes that I file management
and may eliminate to implement methods, like the following code :
Code:
public class File (
    private String path;
    public static int index = 0;
    public File (String path) (
       this.pfad = path;
       // Here you could have the file for read and write
       // I'm concerned with NEM RandomAccessFile   
    )
    public void setSatz (String s) (
        if (!"". equals (s)) (
           Datei.index + +;
           // Here you will add the sentence with the Indexnr.  before
        )  
    )
    public String getSatz (int index) (
        // Here you pass the entire file with ner loop
        // And check when the index is correct, then you give the
        // Set back
       return rate;
    )
    public String getAll () (
       // Again, go through the whole file and the contents  
       // There are a variable dranh?ngen
       alle_saetze return;
    )
    public String phrase search (String search) (
      // Complete file and go through check. Equals if
      // There is a consensus
     search_result return;
    ) 
    public void delSatz (int index) (
      // Complete run file, index and find out 
      // Delete
   )
 )
Reply With Quote
  #3  
Old 27-07-2010
Member
 
Join Date: Apr 2010
Posts: 84
Re: Help for Indexed-sequential file organized in Java

well, make himself thought is good (yes I copied that because I understand the main logic..) You have before you just imagine how times I have done java installation and you should do something. I have really tried to do lot of things.. Anyways I would like to Thank You for trying to solve my problem.
Reply With Quote
  #4  
Old 27-07-2010
Member
 
Join Date: Apr 2008
Posts: 193
Re: Help for Indexed-sequential file organized in Java

I think that you should create your word class, implement the methods getSatz, addSatz, search phrase, delSatz. I am talking with respect to the coding that has been provided by the "Khushal". Then you will also have to create your class contains an administration NEN Array / Vector of type word. Create the necessary fields in the class word, text, index etc. According to me you should get the solution after doing these things.
Reply With Quote
  #5  
Old 27-07-2010
Member
 
Join Date: Apr 2010
Posts: 84
Re: Help for Indexed-sequential file organized in Java

I once implemented the following..
Code:
import java.util.ArrayList; 
/ ** * This class represents the model of an indexed-organized file with linked index dar. 
* The file contains as many records of any structured to be defined or * simple type. 
* methods for inserting, searching, issuing, changing, deleting a record and output 
* all rates are to implemented. 
* For ease of use was a record with the primitive string data type selected. * * @ author Daniel Pernold * @ version 3.0 * / public class File (/ / instance variables private ArrayList file; private int number; 
/ ** * Constructor for objects of the class file management * / 
public File () 
(/ / initialize instance variable file = new ArrayList (); int number = 0;) 
/ ** * method for inserting a sentence in the array * 
* @ param index the index value of the sentence in the array 
* @ param set the contents of the corresponding index value * / 
public void satzPaste (String content) 
(// In the event that the rate Delete method, the value of the number variables 
// does not reduce the delete if (datei.size () <number) (System.out.println ("Here is something gone wrong"); System.out.println ("------------- ------------------------");) 
// If everything works correctly, add the sentence to datei.add else ((number, content); number + +;) 
/ ** * method for outputting a record * 
* @ param index the index value of the sentence in the array to be output) will * / 
public void satzType (int index)
(// If the ArrayList is not empty if (! file . isEmpty ()) 
(// If we enter an index does not yet exist if (index> = datei.size ()) (System.out.println ("This script is not yet available"); 
System.out.println ("-------------------------------------");) else (System.out.println (index + ":" + datei.get (index)); System.out.println ("---------------------------- ---------");)) 
// If the ArrayList is empty else (System.out.println ("The file has set no store"); System.out.println ("---- ---------------------------------");)) / ** * Method to change a record * 
* @ param index the index value of the sentence in the array to be changed * @ param content the content to Amending the set * / 
public void satzSize (int index, String content) 
(// If the ArrayList is not empty if (! datei.isEmpty ( )) (/ / If we enter an index does not yet exist if (index> = datei.size ()) 
(System.out.println ("This script is not yet available"); System.out.println ("- ------------------------------------");) else (datei.set (index content) , ("The record with the index" + index + "was"); System.out.println ("successfully to the value" + content + System.out.println "changed"); System.out.println ("- ------------------------------------");)) 
// If the ArrayList is empty else ( System.out.println ("The file has set no store"); System.out.println ("--------------------------- )) 
/ ** * Method to delete a sentence is a sentence deleted * ----------"); shifts the index of following sentences * 
* @ param index the index value of the sentence in the array to be deleted should */ 
public void rate Delete (int index) (// If the ArrayList is not empty, delete the sentence and in lower number by one if (! datei.isEmpty ()) 
(// If you enter an index does not yet exist if (index> = datei.size ()) (System.out.println ("This script is not yet available"); System.out.println ("---------------- ---------------------");) else (datei.remove (index) number - System.out.println ("The record with the index "+ index +" was deleted successfully "); System.out.println ("-------------------------------- -----");)) // If the ArrayList is empty else (System.out.println ("The file has set no store"); System.out.println ("-------- -----------------------------");)) 
/ ** * Method to output all records * / 
public void alleSaetzeAusgeben () (// If the ArrayList is not empty if (! datei.isEmpty ()) (for (int index = 0; index <datei.size (); index + +) (System.out.println (index + ":" + file . get (index));) System.out.println ("----------------------------------- --");) 
// If the ArrayList is empty else (System.out.println ("The file has set no store"); System.out.println ("------------ -------------------------");)) / ** * method for the sequential search of a set * / 
public void rate search (String value) 
( // If the ArrayList is not empty if (()) (boolean found = false datei.isEmpty for (int index = 0; index <datei.size (); index + +) (if (datei.get (index). equals (value)) (System.out.println ("Found!") System.out.println (index + ":" + datei.get (index)); System.out.println ("----- --------------------------------"); found = true;)) if (found == false) (System . out.println ("Nothing Found"); System.out.println ("------------------------------- ------");))
 // If the ArrayList is empty else (System.out.println ("The file has set no store"); System.out.println ("------- ------------------------------");)) / ** * Method to delete all records * / 
public void allClass ( ) (datei.removeAll (file);))
Please Help, it is supposed to be chained!! :
Reply With Quote
  #6  
Old 27-07-2010
Member
 
Join Date: Dec 2008
Posts: 183
Re: Help for Indexed-sequential file organized in Java

After looking at your code, I made another one, and I am sure that it will help you.
Code:
/ * * Created on 11.01.2005 * * / 
package com.yourname.datei / ** * @ author bello * * / 
public interface File (public void addSatz (String set) 
public void write set (int index) public void aendereSatz (int index, String set); 
.public void deleteSatz (int index) public void printSaetze () 
public void search set (String set); public void clear ();) 
/ * * Created on 01.11.2005 * * / 
package com.yourname.datei; import java.util.Iterator; import java.util.NoSuchElementException 
/ ** * @ author bello * * / 
public class DateiImpl implements File (private ElementWrapper first; private ElementWrapper last; private int count; public DateiImpl () 
(first = last = null; count = 0;) public void addSatz (String set) 
(if (count == 0) (first = new ElementWrapper () last = first; count = 1;) else (last. next = new ElementWrapper (); last = last.next; + + count;) last.id = count; last.element = rate; last.next = null;) 
public void moreSatz (int index, String set) (boolean success = false; Iterator iter = this.iterator () while (iter.hasNext ()) 
(ElementWrapper ew = (ElementWrapper) iter.next (); if (ew.id == index) (= ew.element rate; success = true;)) 
if (success) (System.out.println ("Successfully changed");) else (System.out.println ("phrase not found");)) 
public void clear () 
(while (first! = null) (ElementWrapper tmp = first; first = first.next; tmp.next = null;) first = last = null; count = 0;) 
public void deleteSatz (int index) (ElementWrapper before = null; boolean success = false ; Iterator iter = this.iterator () while (iter.hasNext ()) 
(s = ElementWrapper (ElementWrapper) iter.next (); if (s.id ==) 
(if (before! = null) (before index . s.next next =, s = null;) else (first = s.next; s = null;) success = true; 
System.out.println ("phrase deleted with id:" + index);) if (! success) before = s;) if (success) 
System.out.println ("phrase not found with index" + index);) public void printSaetze () (boolean success = false; Iterator iter = this.iterator (); while (iter.hasNext ()) 
(ElementWrapper s = (iter.next ElementWrapper) () System.out.println ("record with id:" + s.id + ":" + s.element) success = true ;) 
if (success) System.out.println ("Nothing found to print");) 
public void phrase search (String set) (boolean success = false; Iterator iter = this.iterator () while (iter.hasNext ( )) 
(s = ElementWrapper (ElementWrapper) iter.next (); 
if (s.element.equals (set)) (System.out.println ("set found:" + (String) s.element) success = true ;)) 
if (success) System.out.println ("found set" + set);) public void write set (int index) (boolean success = false not; Iterator iter = this.iterator () while (iter. hasNext ()) 
(s = ElementWrapper (ElementWrapper) iter.next (); 
if (s.id == index) (System.out.println ("set found:" + (String) s.element) success = true ;)) 
if (success) System.out.println ("phrase not found with index" + index);) private Iterator iterator () (return new Iterator () (ElementWrapper tmp = first; public boolean hasNext () (return! tmp! = null;) 
public Object next () (if (tmp == null) (throw new NoSuchElementException ();) Object ret = tmp; tmp.next = tmp; return ret;) 
public void remove () (throw new UnsupportedOperationException ();))) class ElementWrapper (int id; public Object element; public ElementWrapper next;))
 / * * Created on 11.01.2005 * * / package com.yourname.datei / ** * * @ author bello * / 
public class TestClass (public static void main (String [] args) (File di = new DateiImpl (); 
String firstSatz = "first rate" String secondSatz = "second rate" 
String third set = "third rate"-ie.addSatz (firstSatz); 
di.addSatz (secondSatz); 
di.addSatz (third sentence); 
di.printSaetze (); 
di.searchSatz (firstSatz); 
di.searchSatz ("different set"); 
di.writeSatz (1); 
di.writeSatz (10); 
di.deleteSatz (2); 
di.printSaetze (); 
System.exit (0);))
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Help for Indexed-sequential file organized in Java"
Thread Thread Starter Forum Replies Last Post
Error:"File not indexed, cannot import" while indexing on Windows Movie Maker Shazid Windows Software 4 19-04-2011 04:34 AM
Sequential file and Random file in VB ? GOOL Software Development 3 08-01-2011 08:52 AM
Indexed Sequential Access Method Davis Alek Software Development 3 31-08-2009 12:15 PM
The file is not indexed and cannot be imported NIcaBoy Windows XP Support 2 24-10-2006 11:51 AM


All times are GMT +5.5. The time now is 01:00 PM.