// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) braces deadcode fieldsfirst 
// Source File Name:   SQLName.java
// Class Version:      45.3

package oracle.sql;

import java.io.*;
import java.sql.SQLException;
import oracle.jdbc.OracleConnection;
import oracle.jdbc.dbaccess.DBError;

// flag ACC_SUPER is set
public class SQLName
    implements Serializable
{
    // Constants:          164
    // Interfaces:         1
    // Fields:             8
    // Methods:            14
    // Class Attributes:   1


    static boolean DEBUG = false;
    static boolean s_parseAllFormat = false;
    static final long serialVersionUID = 0x1f73a88a22280046L;
    String name;
    String schema;
    String simple;
    int version;
    boolean synonym;

    // Decompiling method: <init>  Signature: ()V
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 2015
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type V At 0 5 Range 0 4 Init 0 fixed
    protected SQLName()
    {
        super();
        return;
    }

    // Decompiling method: <init>  Signature: (Ljava/lang/String;Ljava/lang/String;Loracle/jdbc/OracleConnection;)V
    // Max stack: 4, #locals: 4, #params: 4
    // Code length: 58 bytes, Code offset: 2058
    // Line Number Table found: 7 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 58 Range 0 57 Init 0 fixed
    // Parameter  1 added: Name s Type Ljava/lang/String; At 0 58 Range 0 57 Init 0
    // Parameter  2 added: Name s1 Type Ljava/lang/String; At 0 58 Range 0 57 Init 0
    // Parameter  3 added: Name oracleconnection Type Loracle/jdbc/OracleConnection; At 0 58 Range 0 57 Init 0
    // RetValue   4 added: Name <returnValue> Type V At 0 58 Range 0 57 Init 0 fixed
    protected SQLName(String s, String s1, OracleConnection oracleconnection)
        throws SQLException
    {
        super();
        schema = s;
        simple = s1;
        name = schema + "." + simple;
        version = 2;
        synonym = false;
        return;
    }

    // Decompiling method: <init>  Signature: (Ljava/lang/String;Loracle/jdbc/OracleConnection;)V
    // Max stack: 3, #locals: 3, #params: 3
    // Code length: 21 bytes, Code offset: 2188
    // Line Number Table found: 5 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 21 Range 0 20 Init 0 fixed
    // Parameter  1 added: Name s Type Ljava/lang/String; At 0 21 Range 0 20 Init 0
    // Parameter  2 added: Name oracleconnection Type Loracle/jdbc/OracleConnection; At 0 21 Range 0 20 Init 0
    // RetValue   3 added: Name <returnValue> Type V At 0 21 Range 0 20 Init 0 fixed
    public SQLName(String s, OracleConnection oracleconnection)
        throws SQLException
    {
        super();
        init(s, oracleconnection);
        version = 2;
        synonym = false;
        return;
    }

    // Decompiling method: getHandleDoubleQuote  Signature: ()Z
    // Max stack: 1, #locals: 0, #params: 0
    // Code length: 4 bytes, Code offset: 2273
    // Line Number Table found: 1 entries
    // RetValue   0 added: Name <returnValue> Type Z At 0 4 Range 0 3 Init 0 fixed
    public static boolean getHandleDoubleQuote()
        throws SQLException
    {
        return s_parseAllFormat;
    }

    // Decompiling method: getName  Signature: ()Ljava/lang/String;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 2325
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/lang/String; At 0 5 Range 0 4 Init 0 fixed
    public String getName()
        throws SQLException
    {
        return name;
    }

    // Decompiling method: getSchema  Signature: ()Ljava/lang/String;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 2378
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/lang/String; At 0 5 Range 0 4 Init 0 fixed
    public String getSchema()
        throws SQLException
    {
        return schema;
    }

    // Decompiling method: getSimpleName  Signature: ()Ljava/lang/String;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 2431
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Ljava/lang/String; At 0 5 Range 0 4 Init 0 fixed
    public String getSimpleName()
        throws SQLException
    {
        return simple;
    }

    // Decompiling method: getVersion  Signature: ()I
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 2484
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type I At 0 5 Range 0 4 Init 0 fixed
    public int getVersion()
        throws SQLException
    {
        return version;
    }

    // Decompiling method: init  Signature: (Ljava/lang/String;Loracle/jdbc/OracleConnection;)V
    // Max stack: 4, #locals: 5, #params: 3
    // Code length: 134 bytes, Code offset: 2537
    // Line Number Table found: 12 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 134 Range 0 133 Init 0 fixed
    // Parameter  1 added: Name s Type Ljava/lang/String; At 0 134 Range 0 133 Init 0
    // Parameter  2 added: Name oracleconnection Type Loracle/jdbc/OracleConnection; At 0 134 Range 0 133 Init 0
    // RetValue   5 added: Name <returnValue> Type V At 0 134 Range 0 133 Init 0 fixed
    // LocalVar   3 added: Name as Type [Ljava/lang/String; At 4 19 Range 4 22 Init 4
    // LocalVar   4 added: Name as1 Type [Ljava/lang/String; At 9 43 Range 9 51 Init 9
    private void init(String s, OracleConnection oracleconnection)
        throws SQLException
    {
        String as[] = new String[1];
        String as1[] = new String[1];
        if(parse(s, as, as1))
        {
            schema = as[0];
            simple = as1[0];
        } else
        {
            schema = oracleconnection.getUserName();
            simple = as1[0];
        }
        if(DEBUG)
        {
            System.out.println("schema = " + schema + " simple = " + simple);
        }
        name = schema + "." + simple;
        return;
    }

    // Decompiling method: parse  Signature: (Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)Z
    // Max stack: 5, #locals: 7, #params: 3
    // Code length: 317 bytes, Code offset: 2763
    // Line Number Table found: 42 entries
    // Parameter  0 added: Name s Type Ljava/lang/String; At 0 317 Range 0 316 Init 0
    // Parameter  1 added: Name as Type [Ljava/lang/String; At 0 317 Range 0 316 Init 0
    // Parameter  2 added: Name as1 Type [Ljava/lang/String; At 0 317 Range 0 316 Init 0
    // RetValue   7 added: Name <returnValue> Type Z At 0 317 Range 0 316 Init 0 fixed
    // LocalVar   3 added: Name i Type I At 71 24 Range 71 94 Init 71
    // LocalVar   3 added: Name j Type I At 107 79 Range 107 185 Init 107
    // LocalVar   4 added: Name k Type I At 114 193 Range 114 306 Init 114
    // LocalVar   5 added: Name l Type I At 126 185 Range 126 310 Init 126
    // LocalVar   6 added: Name byte0 Type B At 129 2 Range 129 130 Init 129
    // LocalVar   6 added: Name i1 Type I At 142 28 Range 142 169 Init 142
    // LocalVar   6 added: Name j1 Type I At 214 47 Range 214 260 Init 214
    // LocalVar   6 added: Name k1 Type I At 290 8 Range 290 297 Init 290
    public static boolean parse(String s, String as[], String as1[])
        throws SQLException
    {
        if(s == null)
        {
            return false;
        }
        if(as == null || as.length < 1 || as1 == null || as1.length < 1)
        {
            DBError.throwSqlException(68);
        }
        if(DEBUG)
        {
            System.out.println("sql_name = " + s);
        }
        if(!s_parseAllFormat)
        {
            int i = s.indexOf(".");
            if(i < 0)
            {
                as1[0] = s;
                return false;
            } else
            {
                as[0] = s.substring(0, i);
                as1[0] = s.substring(i + 1);
                return true;
            }
        }
        int j = s.length();
        int k = s.indexOf("\"");
        int l = s.indexOf("\"", k + 1);
        byte byte0 = -1;
        if(k < 0)
        {
            int i1 = s.indexOf(".");
            if(i1 < 0)
            {
                as1[0] = s;
                return false;
            } else
            {
                as[0] = s.substring(0, i1);
                as1[0] = s.substring(i1 + 1);
                return true;
            }
        }
        if(k == 0)
        {
            if(l == j - 1)
            {
                as1[0] = s.substring(k + 1, l);
                return false;
            }
            int j1 = s.indexOf(".", l);
            as[0] = s.substring(k + 1, l);
            k = s.indexOf("\"", j1);
            l = s.indexOf("\"", k + 1);
            if(k < 0)
            {
                as1[0] = s.substring(j1 + 1);
                return true;
            } else
            {
                as1[0] = s.substring(k + 1, l);
                return true;
            }
        } else
        {
            int k1 = s.indexOf(".");
            as[0] = s.substring(0, k1);
            as1[0] = s.substring(k + 1, l);
            return true;
        }
    }

    // Decompiling method: readObject  Signature: (Ljava/io/ObjectInputStream;)V
    // Max stack: 2, #locals: 2, #params: 2
    // Code length: 41 bytes, Code offset: 3292
    // Line Number Table found: 6 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 41 Range 0 40 Init 0 fixed
    // Parameter  1 added: Name objectinputstream Type Ljava/io/ObjectInputStream; At 0 41 Range 0 40 Init 0
    // RetValue   2 added: Name <returnValue> Type V At 0 41 Range 0 40 Init 0 fixed
    private void readObject(ObjectInputStream objectinputstream)
        throws IOException, ClassNotFoundException
    {
        name = objectinputstream.readUTF();
        schema = objectinputstream.readUTF();
        simple = objectinputstream.readUTF();
        version = objectinputstream.readInt();
        synonym = objectinputstream.readBoolean();
        return;
    }

    // Decompiling method: setHandleDoubleQuote  Signature: (Z)V
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 3403
    // Line Number Table found: 2 entries
    // Parameter  0 added: Name flag Type Z At 0 5 Range 0 4 Init 0
    // RetValue   1 added: Name <returnValue> Type V At 0 5 Range 0 4 Init 0 fixed
    public static void setHandleDoubleQuote(boolean flag)
        throws SQLException
    {
        s_parseAllFormat = flag;
        return;
    }

    // Decompiling method: writeObject  Signature: (Ljava/io/ObjectOutputStream;)V
    // Max stack: 2, #locals: 2, #params: 2
    // Code length: 41 bytes, Code offset: 3460
    // Line Number Table found: 6 entries
    // Parameter  0 added: Name this Type Loracle/sql/SQLName; At 0 41 Range 0 40 Init 0 fixed
    // Parameter  1 added: Name objectoutputstream Type Ljava/io/ObjectOutputStream; At 0 41 Range 0 40 Init 0
    // RetValue   2 added: Name <returnValue> Type V At 0 41 Range 0 40 Init 0 fixed
    private void writeObject(ObjectOutputStream objectoutputstream)
        throws IOException
    {
        objectoutputstream.writeUTF(name);
        objectoutputstream.writeUTF(schema);
        objectoutputstream.writeUTF(simple);
        objectoutputstream.writeInt(version);
        objectoutputstream.writeBoolean(synonym);
        return;
    }

    // Decompiling method: <clinit>  Signature: ()V
    // Max stack: 1, #locals: 0, #params: 0
    // Code length: 9 bytes, Code offset: 1960
    // Line Number Table found: 3 entries
    // RetValue   0 added: Name <returnValue> Type V At 0 9 Range 0 8 Init 0 fixed
    static 
    {
        /* DEBUG = false; */
        /* s_parseAllFormat = false; */
    }
}
