Пример #1
0
	        public SyncCommand(int nCode, String strParam, int nCmdParam, boolean bShowStatus)
	        {
		        m_nCmdCode = nCode;
		        m_strCmdParam = strParam;
                m_nCmdParam = nCmdParam;
                m_bShowStatus = bShowStatus;
	        }
Пример #2
0
 public CThreadQueue()
 {
     m_nPollInterval = QUEUE_POLL_INTERVAL_SECONDS;
     m_bNoThreaded = false;
 
     m_mxStackCommands = getSyncObject();
 }
Пример #3
0
          public SyncCommand(int nCode, boolean bShowStatus, String query_params)
 		    {
 			    m_nCmdCode = nCode;
 			    m_nCmdParam = 0;
 			    m_bShowStatus = bShowStatus;
              m_strQueryParams = query_params != null ? query_params : "";
 		    }
Пример #4
0
 public MidiDeviceImp( uint device_id ){
     s_device = new MidiOutDevice( device_id );
     s_initialized = true;
     for ( int i = 0; i < CHANNEL; i++ ) {
         s_last_program[i] = -1;
     }
 }
Пример #5
0
	public FileCache(LogManager log, IMethodFilter methodFilter, FileCacheManager manager, IFileObject file, int blockSize) {
		_log = log;
		_dirty = false;
		_manager = manager;
		_file = file;
		_blockSize = blockSize;
		_methodFilter = methodFilter;
	}
Пример #6
0
 public void decreaseHealth(int damageIn)
 {
     if(health > 0)
     {
         health -= damageIn;
         alive = false;
     }//if
 }
Пример #7
0
     public SyncNotification(String strUrl, String strParams, boolean bRemoveAfterFire)
     {
         if ( strUrl.length() > 0 )
             m_strUrl = RHODESAPP().canonicalizeRhoUrl(strUrl);
 	
 	    m_strParams = strParams; 
 	    m_bRemoveAfterFire = bRemoveAfterFire; 
     }
Пример #8
0
 public Medico(String dni, String nombre, String apeliido, Especialidad especialidad)
 {
     this.dniMedico = dni;
     this.nombre = nombre;
     this.apellido = apellido;
     this.especialidad = especialidad;
     boxes = new List<Box>();
     this.libre = true;
 }
Пример #9
0
	public IDBResult executeSQL(String strStatement, Object[] values, boolean bNoCopy)
    {
		LOG.TRACE("executeSQL: " + strStatement + ";" + values);
		IDBResult res = null;
		Lock();
		try{
            res = m_dbStorage.executeSQL(strStatement, values, false, bNoCopy);
		}finally
		{
			Unlock();
		}
		return res;
	}
Пример #10
0
 //Helper Method to check if a row, column or section is valid
 private boolean validHelper(char[][] board, int sRow, int eRow, int sCol, int eCol){
     boolean[] used = new boolean[10];
     for(int i=sRow; i<=eRow;i++){
         for(int j=sCol;j<=eCol;j++){
             if(board[i][j]=='.')  //if the cell is empty
                 continue;
             if(used[board[i][j]-'0'])  //if the number already used, not valid
                 return false;
             used[board[i][j]-'0']=true; //if the number is not used, set it as used
         }
     }
     return true;
 }
 public void move(Dice d){
   int steps = d.roll();
   position=position+steps;
   if(this.position==99){
     //pas finish
     this.win = true;
   }else if(this.position>99){
     //jika melebihi dari finish
     int pos = this.position-99;
     this.position = this.position-pos;
   }
   
 }
Пример #12
0
    public void go () {
      if (chance (disorder)) 
        left_handed = chance (Squiral.this.left_handed);

      if ((left_handed          // left-handed
        && !try_go (counter_clockwise ())
        && !try_go (direction)  // straight
        && !try_go (clockwise ()))
        
        || (!left_handed        // right-handed
          && !try_go (clockwise ())
          && !try_go (direction) // straight
          && !try_go (counter_clockwise ())))

        // stuck, raise a new worm
        init ();
    }
Пример #13
0
        public static int JoyInit() {
            if ( s_initialized ) {
                JoyReset();
            }
            s_initialized = true;
            int num_joydev = (int)win32.joyGetNumDevs();
#if DEBUG
            cadencii.debug.push_log( "winmmhelp.JoyInit" );
            cadencii.debug.push_log( "    num_joydev=" + num_joydev );
#endif
            if ( num_joydev <= 0 ) {
                num_joydev = 0;
                return num_joydev;
            }
            s_joy_attatched = new boolean[num_joydev];
            s_joycaps = new JOYCAPSW[num_joydev];
            int count = 0;
            for ( int k = 0; k < num_joydev; k++ ) {
                JOYINFO ji = new JOYINFO();
                if ( win32.joyGetPos( (uint)k, ref ji ) == win32.JOYERR_NOERROR ) {
                    s_joy_attatched[k] = true;
                    JOYCAPSW jc = new JOYCAPSW();
                    win32.joyGetDevCapsW( (uint)k, ref jc, (uint)Marshal.SizeOf( jc ) );
                    s_joycaps[k] = jc;
                    count++;
                } else {
                    s_joy_attatched[k] = false;
                }
            }
            if ( count > 0 ) {
                s_joy_available = new int[count];
                int c = -1;
                for ( int i = 0; i < num_joydev; i++ ) {
                    if ( s_joy_attatched[i] ) {
                        c++;
                        if ( c >= count ) {
                            break; //ここに来るのはエラー
                        }
                        s_joy_available[c] = i;
                    }
                }
            }
            s_num_joydev = (uint)count;
            return (int)s_num_joydev;
        }
Пример #14
0
        public Rorschach(String [] args)
        {
            base (args, true, true, true, 16, 2000);

            depth = option.intt ("depth", "level of details", 10000);
            draw_delay = option.longg ("draw-delay",
              "delay between iterations in millis", 10);
            offset = option.intt ("offset", "compactness of pattern", 4);
            int step_count = option.intt ("step-count",
              "total number of steps", 50);
            x_symmetry = option.booleann ("x-symmetry",
              "if symmetry along x-axis", true);
            y_symmetry = option.booleann ("y-symmetry",
              "if symmetry along y-axis", false);

            about ("0.1", "simulate ink-blot patterns",
              "Stephen Tse <*****@*****.**>",
              "http://escher.sourceforge.net/");

            if (help_option) return;

            step_size = depth / step_count;
        }
Пример #15
0
        public static void RestartMetronome() {
            m_stop_metronome_required = false;
            if ( m_vsq != null ) {
                double now = PortUtil.getCurrentTime();
                double elapsed = ((now - m_started) + 0.25) * m_speed;
                int clock = (int)m_vsq.getClockFromSec( m_started_sec + elapsed );

                ByRef<Integer> bar = new ByRef<Integer>();
                Timesig timesig = m_vsq.getTimesigAt( clock, bar );
                int clock_at_bartop = m_vsq.getClockFromBarCount( bar.value );
                int clock_step = 480 * 4 / timesig.denominator;
                int next_clock = clock_at_bartop + ((clock - clock_at_bartop) / clock_step + 1) * clock_step;

                MidiQueue mq = new MidiQueue();
                mq.Track = 0;
                mq.Clock = next_clock;
                mq.Channel = 14;
                mq.Program = ProgramNormal;
                mq.Note = NoteNormal;
                mq.Velocity = 0x40;
                mq.Done += new MidiQueueDoneEventHandler( ReGenerateMidiQueue );
                s_queue.add( mq );

                if ( (next_clock - clock_at_bartop) % (timesig.numerator * clock_step) == 0 ) {
                    MidiQueue mq_bell = new MidiQueue();
                    mq_bell.Track = 0;
                    mq_bell.Clock = next_clock;
                    mq_bell.Channel = 15;
                    mq_bell.Program = ProgramBell;
                    mq_bell.Note = NoteBell;
                    mq_bell.Velocity = 0x40;
                    s_queue.add( mq_bell );
                }
                Collections.sort( s_queue );
            }
        }
Пример #16
0
        public Munch(String [] args)
        {
            base (args, true, true, false, 16, 2000);

            draw_delay = option.longg ("draw-delay",
              "delay between iterations in millis", 10);
            min_size = option.intt ("min-size",
              "minimum size of square", 64);
            shift = option.booleann ("shift",
              "shift factor = munch in random order", true);
            square_count = option.intt ("square-count",
              "total number of squares", 5);
            xor = option.booleann ("xor",
              "use xor function to draw", true);

            about ("0.1", "munching squares",
              "Stephen Tse <*****@*****.**>",
              "http://escher.sourceforge.net/");

            if (help_option) return;

            // TODO alpha composite (from RENDER/GLX) instead of xor?
            if (xor) gc.set_function (gnu.x11.GC.Values.XOR);
        }
Пример #17
0
 public void ASSERT(boolean exp, String message)
 {
     if (!exp)
         logMessage(L_FATAL, message);
 }
Пример #18
0
 public action()
 {
     this.defaultField = boolean.False;
 }
Пример #19
0
 public gameVariable()
 {
     this.defaultField = "0";
     this.resetField   = boolean.True;
     this.globalField  = boolean.True;
 }
Пример #20
0
        /// <summary>
        /// スクリプトを実行します。
        /// </summary>
        /// <param name="evsd"></param>
        public static boolean invokeScript(String id, VsqFileEx vsq)
        {
            ScriptInvoker script_invoker = null;

            if (scripts.containsKey(id))
            {
                script_invoker = scripts.get(id);
            }
            else
            {
                return(false);
            }
            if (script_invoker != null && script_invoker.scriptDelegate != null)
            {
                try {
                    VsqFileEx          work = (VsqFileEx)vsq.clone();
                    ScriptReturnStatus ret  = ScriptReturnStatus.ERROR;
                    if (script_invoker.scriptDelegate is EditVsqScriptDelegate)
                    {
                        boolean b_ret = ((EditVsqScriptDelegate)script_invoker.scriptDelegate).Invoke(work);
                        if (b_ret)
                        {
                            ret = ScriptReturnStatus.EDITED;
                        }
                        else
                        {
                            ret = ScriptReturnStatus.ERROR;
                        }
                    }
                    else if (script_invoker.scriptDelegate is EditVsqScriptDelegateEx)
                    {
                        boolean b_ret = ((EditVsqScriptDelegateEx)script_invoker.scriptDelegate).Invoke(work);
                        if (b_ret)
                        {
                            ret = ScriptReturnStatus.EDITED;
                        }
                        else
                        {
                            ret = ScriptReturnStatus.ERROR;
                        }
                    }
                    else if (script_invoker.scriptDelegate is EditVsqScriptDelegateWithStatus)
                    {
                        ret = ((EditVsqScriptDelegateWithStatus)script_invoker.scriptDelegate).Invoke(work);
                    }
                    else if (script_invoker.scriptDelegate is EditVsqScriptDelegateExWithStatus)
                    {
                        ret = ((EditVsqScriptDelegateExWithStatus)script_invoker.scriptDelegate).Invoke(work);
                    }
                    else
                    {
                        ret = ScriptReturnStatus.ERROR;
                    }
                    if (ret == ScriptReturnStatus.ERROR)
                    {
                        AppManager.showMessageBox(_("Script aborted"), "Cadencii", cadencii.windows.forms.Utility.MSGBOX_DEFAULT_OPTION, cadencii.windows.forms.Utility.MSGBOX_INFORMATION_MESSAGE);
                    }
                    else if (ret == ScriptReturnStatus.EDITED)
                    {
                        CadenciiCommand run = VsqFileEx.generateCommandReplace(work);
                        AppManager.editHistory.register(vsq.executeCommand(run));
                    }
                    String           config_file          = configFileNameFromScriptFileName(script_invoker.ScriptFile);
                    FileOutputStream fs                   = null;
                    boolean          delete_xml_when_exit = false; // xmlを消すときtrue
                    try {
                        fs = new FileOutputStream(config_file);
                        script_invoker.Serializer.serialize(fs, null);
                    } catch (Exception ex) {
                        serr.println("AppManager#invokeScript; ex=" + ex);
                        delete_xml_when_exit = true;
                    } finally {
                        if (fs != null)
                        {
                            try {
                                fs.close();
                                if (delete_xml_when_exit)
                                {
                                    PortUtil.deleteFile(config_file);
                                }
                            } catch (Exception ex2) {
                                serr.println("AppManager#invokeScript; ex2=" + ex2);
                            }
                        }
                    }
                    return(ret == ScriptReturnStatus.EDITED);
                } catch (Exception ex) {
                    AppManager.showMessageBox(_("Script runtime error:") + " " + ex, _("Error"), cadencii.windows.forms.Utility.MSGBOX_DEFAULT_OPTION, cadencii.windows.forms.Utility.MSGBOX_INFORMATION_MESSAGE);
                    serr.println("AppManager#invokeScript; ex=" + ex);
                }
            }
            else
            {
                AppManager.showMessageBox(_("Script compilation failed."), _("Error"), cadencii.windows.forms.Utility.MSGBOX_DEFAULT_OPTION, cadencii.windows.forms.Utility.MSGBOX_WARNING_MESSAGE);
            }
            return(false);
        }
Пример #21
0
 public void setAlwaysOnTop( boolean alwaysOnTop ) {
     base.TopMost = alwaysOnTop;
 }
Пример #22
0
 public game()
 {
     this.scriptVersionField = "0.0.0.0";
     this.usetwosidedtableField = boolean.True;
     this.noteBackgroundColorField = "#FFEBE8C5";
     this.noteForegroundColorField = "#FF000000";
 }
Пример #23
0
 public gameVariable()
 {
     this.defaultField = "0";
     this.resetField = boolean.True;
     this.globalField = boolean.True;
 }
Пример #24
0
 /** {@inheritDoc} */
 public void setUnresolved(boolean unresolved)
 {
     this.unresolved = unresolved;
 }
Пример #25
0
 public propertyDef()
 {
     this.ignoreTextField = boolean.False;
     this.textKindField = propertyDefTextKind.Free;
     this.hiddenField = "False";
 }
Пример #26
0
        public void rb_destroy_tables(Vector <String> vecIncludes, Vector <String> vecExcludes)
        {
            if (!m_bIsOpen)
            {
                return;
            }

            IDBStorage db = null;

            try{
                String dbNewName = CFilePath.changeBaseName(m_strDBPath, "resetdbtemp.sqlite");

                CRhoFile.deleteFile(dbNewName);
                CRhoFile.deleteFile(dbNewName + "-journal");
                CRhoFile.deleteFile(dbNewName + ".version");

                db = RhoClassFactory.createDBStorage();
                db.open(dbNewName, getSqlScript(), getEncryptionInfo());

                String[] vecTables = m_dbStorage.getAllTableNames();
                //IDBResult res;

                db.startTransaction();

                for (int i = 0; i < vecTables.Length; i++)
                {
                    String tableName = vecTables[i];
                    if (destroyTableName(tableName, vecIncludes, vecExcludes))
                    {
                        continue;
                    }

                    copyTable(tableName, this.m_dbStorage, db);
                }

                db.commit();
                db.close();

                String dbOldName = m_strDBPath;

                m_dbStorage.close();
                m_dbStorage = null;
                m_bIsOpen   = false;

                CRhoFile.deleteFilesInFolder(RHODESAPP().getBlobsDirPath());

                string[] ar1 = CRhoFile.enumDirectory("db");

                CRhoFile.deleteFile(dbOldName);
                CRhoFile.deleteFile(dbOldName + "-journal");
                CRhoFile.renameFile(dbNewName, dbOldName);
                CRhoFile.renameFile(dbNewName + "-journal", dbOldName + "-journal");

                string[] ar2 = CRhoFile.enumDirectory("db");

                m_dbStorage = RhoClassFactory.createDBStorage();
                m_dbStorage.open(m_strDBPath, getSqlScript(), getEncryptionInfo());
                m_bIsOpen = true;

                string[] ar3 = CRhoFile.enumDirectory("db");
                m_dbStorage.setDbCallback(new DBCallback(this));
            }catch (Exception e)
            {
                LOG.ERROR("destroy_table failed.", e);

                if (!m_bIsOpen)
                {
                    LOG.ERROR("destroy_table error.Try to open old DB.");
                    try{
                        m_dbStorage.open(m_strDBPath, getSqlScript(), getEncryptionInfo());
                        m_bIsOpen = true;
                    }catch (Exception exc)
                    {
                        LOG.ERROR("destroy_table open old table failed.", exc);
                    }
                }

                try {
                    if (db != null)
                    {
                        db.close();
                    }
                } catch (DBException e1) {
                    LOG.ERROR("closing of DB caused exception: " + e1.Message);
                }

                throw e;
            }
        }
Пример #27
0
 /** {@inheritDoc} */
 public void setDrawInterior(boolean draw)
 {
     this.drawInterior = draw;
 }
Пример #28
0
        private static bool loaded = false; //Checks if OpenGL Window is active

        public static void setLoaded(boolean inpt)
        {
            loaded = inpt;
        }
Пример #29
0
 /** 
  * Load class file data into namespace of this class loader.
  *
  * @param name fully-qualified class name
  * @param data raw bytes of class file
  */
 public Class load (String name, byte [] data, boolean resolve) {
   Class klass = defineClass (name, data, 0, data.Length);
   if (resolve) resolveClass (klass);
   classes.put (name, klass);
   return klass;
 }
Пример #30
0
 /** {@inheritDoc} */
 public void setDrawOutline(boolean draw)
 {
     this.drawOutline = draw;
 }
Пример #31
0
        void checkDBVersion()
        {
            DBVersion dbNewVer = new DBVersion();

            dbNewVer.m_strRhoVer = RhoRuby.getRhoDBVersion();
            dbNewVer.m_strAppVer = RhoConf.getInstance().getString("app_db_version");
            String strEncryptionInfo = getEncryptionInfo();

            dbNewVer.m_bEncrypted = strEncryptionInfo != null && strEncryptionInfo.length() > 0;
            dbNewVer.m_bSqlite    = true;

            DBVersion dbVer = new DBVersion();

            dbVer.fromFile(m_strDbVerPath);

            if (dbVer.m_strRhoVer.length() == 0)
            {
                dbNewVer.toFile(m_strDbVerPath);
                return;
            }

            boolean bRhoReset = dbVer.isRhoVerChanged(dbNewVer);
            boolean bAppReset = dbVer.isAppVerChanged(dbNewVer);

            boolean bDbFormatChanged = dbVer.isDbFormatChanged(dbNewVer);

            if (!bDbFormatChanged && dbVer.m_bEncrypted)
            {
                //TODO: check encryption key
                //if (!com.rho.RhoCrypto.isKeyExist(strEncryptionInfo) )
                //	bDbFormatChanged = true;
            }

            if (bDbFormatChanged)
            {
                LOG.INFO("Reset Database( format changed ):" + m_strDBPath);
            }

            if (bRhoReset && !bAppReset && !bDbFormatChanged)
            {
                bRhoReset = !migrateDB(dbVer, dbNewVer);
            }

            if (bRhoReset || bAppReset || bDbFormatChanged)
            {
                if (!bDbFormatChanged)
                {
                    IDBStorage db = null;
                    try
                    {
                        db = RhoClassFactory.createDBStorage();
                        if (db.isDbFileExists(m_strDBPath))
                        {
                            db.open(m_strDBPath, "", strEncryptionInfo);
                            IDBResult res = db.executeSQL("SELECT * FROM client_info", null, false, false);
                            if (!res.isEnd())
                            {
                                m_strClientInfoInsert = createInsertStatement(res, "client_info");
                                m_dataClientInfo      = res.getCurData();
                            }
                        }
                    }catch (Exception exc)
                    {
                        LOG.ERROR("Copy client_info table failed.", exc);
                    }finally
                    {
                        if (db != null)
                        {
                            try { db.close(); } catch (Exception) {  }
                        }
                    }
                }

                m_dbStorage.deleteAllFiles(m_strDBPath);

                if (this.m_strDbPartition.compareTo("user") == 0)           //do it only once
                {
                    String fName = makeBlobFolderName();
                    CRhoFile.deleteDirectory(fName);
                    makeBlobFolderName();             //Create folder back
                }

                dbNewVer.toFile(m_strDbVerPath);

                if (RhoConf.getInstance().isExist("bulksync_state") && RhoConf.getInstance().getInt("bulksync_state") != 0)
                {
                    RhoConf.getInstance().setInt("bulksync_state", 0, true);
                }
            }
        }
Пример #32
0
 /** {@inheritDoc} */
 public void setEnableAntialiasing(boolean enable)
 {
     this.enableAntialiasing = enable;
 }
Пример #33
0
        public void updateAllAttribChanges()
        {
            //Check for attrib = object
            IDBResult res = executeSQL("SELECT object, source_id, update_type " +
                                       "FROM changed_values where attrib = 'object' and sent=0");

            if (res.isEnd())
            {
                return;
            }

            startTransaction();

            Vector <String> arObj = new Vector <String>(), arUpdateType = new Vector <String>();
            Vector <int>    arSrcID = new Vector <int>();

            for ( ; !res.isEnd(); res.next())
            {
                arObj.addElement(res.getStringByIdx(0));
                arSrcID.addElement(res.getIntByIdx(1));
                arUpdateType.addElement(res.getStringByIdx(2));
            }

            for (int i = 0; i < (int)arObj.size(); i++)
            {
                IDBResult resSrc        = executeSQL("SELECT name, schema FROM sources where source_id=?", arSrcID.elementAt(i));
                boolean   bSchemaSource = false;
                String    strTableName  = "object_values";
                if (!resSrc.isEnd())
                {
                    bSchemaSource = resSrc.getStringByIdx(1).length() > 0;
                    if (bSchemaSource)
                    {
                        strTableName = resSrc.getStringByIdx(0);
                    }
                }

                if (bSchemaSource)
                {
                    IDBResult res2 = executeSQL("SELECT * FROM " + strTableName + " where object=?", arObj.elementAt(i));
                    for (int j = 0; j < res2.getColCount(); j++)
                    {
                        String strAttrib  = res2.getColName(j);
                        String value      = res2.getStringByIdx(j);
                        String attribType = getAttrMgr().isBlobAttr(arSrcID.elementAt(i), strAttrib) ? "blob.file" : "";

                        executeSQLReportNonUnique("INSERT INTO changed_values (source_id,object,attrib,value,update_type,attrib_type,sent) VALUES(?,?,?,?,?,?,?)",
                                                  arSrcID.elementAt(i), arObj.elementAt(i), strAttrib, value, arUpdateType.elementAt(i), attribType, 0);
                    }
                }
                else
                {
                    IDBResult res2 = executeSQL("SELECT attrib, value FROM " + strTableName + " where object=? and source_id=?",
                                                arObj.elementAt(i), arSrcID.elementAt(i));

                    for ( ; !res2.isEnd(); res2.next())
                    {
                        String strAttrib  = res2.getStringByIdx(0);
                        String value      = res2.getStringByIdx(1);
                        String attribType = getAttrMgr().isBlobAttr(arSrcID.elementAt(i), strAttrib) ? "blob.file" : "";

                        executeSQLReportNonUnique("INSERT INTO changed_values (source_id,object,attrib,value,update_type,attrib_type,sent) VALUES(?,?,?,?,?,?,?)",
                                                  arSrcID.elementAt(i), arObj.elementAt(i), strAttrib, value, arUpdateType.elementAt(i), attribType, 0);
                    }
                }
            }

            executeSQL("DELETE FROM changed_values WHERE attrib='object'");

            endTransaction();
        }
Пример #34
0
 /** {@inheritDoc} */
 public void setEnableLighting(boolean enableLighting)
 {
     this.enableLighting = enableLighting;
 }
Пример #35
0
            public static void main(String[] args)
            {
                System.out.println("Welcome to your new job");

                //announceDeveloperTeaTime();

                System.out.println("Get promoted!");

                int studentAge = 15;
                double studentGPA = 3.45;
                boolean hasPerfectAttendance = true;


                String studentFirstName = "Breanna";
                String studentLastName = "White";
                char studentFirstInitial = studentFirstName.charAt(0);
                char studentLastInitial = studentLastName.charAt(0);


                System.out.println(studentAge);
                System.out.println(studentGPA);
                System.out.println(studentFirstInitial);
                System.out.println(studentLastInitial);
                System.out.println(hasPerfectAttendance);
                System.out.println(studentFirstName);
                System.out.println(studentLastName);
                System.out.println(studentFirstName + " " + studentLastName + " " + "has a GPA of " + studentGPA);
                System.out.println("What do you want to update it to?");
                Scanner input = new Scanner(System.in);
                studentGPA = input.nextDouble();

                System.out.println(studentFirstName + " " + studentLastName + " now has a GPA of " + studentGPA);

                System.out.println("Pick a number between 1 and 10");
                Scanner scanner = new Scanner(System.in);

                int inputtedNum = scanner.nextInt();

                if (inputtedNum < 5)
                {
                    System.out.println("Enjoy the good luck a friend brings you");
                }
                else
                {
                    System.out.println("Your shoe selection will make you very happy today");
                }

                Scanner input = new Scanner(System.in);
                boolean isOnRepeat = true;
                while (isOnRepeat)
                {
                    System.out.println("Playing current song");
                    System.out.println("Would you like to take this song off of repeat? If so, answer yes");
                    String userInput = input.next();

                    if (userInput.equals("yes")) ;
                    {
                        isOnRepeat = false;
                    }
                }
                System.out.println("Playing next song");

                //CHALLENGE

                String question = "How many cars do I own?";
                String choiceOne = "one car";
                String choiceTwo = "two cars";
                String choiceThree = "three cars";

                System.out.println(question);
                System.out.println("Choose one of the following: " +
                        choiceOne + ", " + choiceTwo + ",  or " + choiceThree + ".");
                System.out.println(choiceOne);
                System.out.println(choiceTwo);
                System.out.println(choiceThree);

                Scanner scanner = new Scanner(System.in);
                String input = scanner.next();



                if (choiceThree.equals(input))
                {
                    System.out.println("Happy to hear you know how many cars I have, Nice!");
                }
                else
                {
                    System.out.println("You are incorrect. The correct answer is " + choiceThree);
                }








            }
Пример #36
0
        public IDBResult executeSQL(String strStatement, Object[] values, boolean bReportNonUnique, boolean bNoCopy)
        {
            if (m_db == null)
            {
                throw new Exception("executeSQL: m_db == null");
            }

            lock (m_db)
            {
                var           stmt = Prepare(strStatement, values);
                CSqliteResult res  = new CSqliteResult(stmt, bNoCopy);
                int           rc   = res.executeStatement();
                if (rc != Sqlite3.SQLITE_ROW)
                {
                    if (bReportNonUnique && rc == Sqlite3.SQLITE_CONSTRAINT)
                    {
                        res.close();
                        return(new CSqliteResult(true));
                    }

                    res.checkError();
                    res.close();
                }
                return(res);
            }
        }
Пример #37
0
 public override void FillFromDictionary(Dictionary <string, object> dict)
 {
     if (dict.ContainsKey("network_uuid"))
     {
         if (dict["network_uuid"] != null)
         {
             network_uuid = DataType.Instance.FillString(dict["network_uuid"]);
         }
     }
     if (dict.ContainsKey("profile_id"))
     {
         if (dict["profile_id"] != null)
         {
             profile_id = DataType.Instance.FillString(dict["profile_id"]);
         }
     }
     if (dict.ContainsKey("game_area"))
     {
         if (dict["game_area"] != null)
         {
             game_area = DataType.Instance.FillString(dict["game_area"]);
         }
     }
     if (dict.ContainsKey("profile_network"))
     {
         if (dict["profile_network"] != null)
         {
             profile_network = DataType.Instance.FillString(dict["profile_network"]);
         }
     }
     if (dict.ContainsKey("profile_device"))
     {
         if (dict["profile_device"] != null)
         {
             profile_device = DataType.Instance.FillString(dict["profile_device"]);
         }
     }
     if (dict.ContainsKey("game_level"))
     {
         if (dict["game_level"] != null)
         {
             game_level = DataType.Instance.FillString(dict["game_level"]);
         }
     }
     if (dict.ContainsKey("network_external_port"))
     {
         if (dict["network_external_port"] != null)
         {
             network_external_port = DataType.Instance.FillInt(dict["network_external_port"]);
         }
     }
     if (dict.ContainsKey("game_players_connected"))
     {
         if (dict["game_players_connected"] != null)
         {
             game_players_connected = DataType.Instance.FillInt(dict["game_players_connected"]);
         }
     }
     if (dict.ContainsKey("game_state"))
     {
         if (dict["game_state"] != null)
         {
             game_state = DataType.Instance.FillString(dict["game_state"]);
         }
     }
     if (dict.ContainsKey("hash"))
     {
         if (dict["hash"] != null)
         {
             hash = DataType.Instance.FillString(dict["hash"]);
         }
     }
     if (dict.ContainsKey("network_external_ip"))
     {
         if (dict["network_external_ip"] != null)
         {
             network_external_ip = DataType.Instance.FillString(dict["network_external_ip"]);
         }
     }
     if (dict.ContainsKey("profile_username"))
     {
         if (dict["profile_username"] != null)
         {
             profile_username = DataType.Instance.FillString(dict["profile_username"]);
         }
     }
     if (dict.ContainsKey("game_id"))
     {
         if (dict["game_id"] != null)
         {
             game_id = DataType.Instance.FillString(dict["game_id"]);
         }
     }
     if (dict.ContainsKey("game_code"))
     {
         if (dict["game_code"] != null)
         {
             game_code = DataType.Instance.FillString(dict["game_code"]);
         }
     }
     if (dict.ContainsKey("game_player_z"))
     {
         if (dict["game_player_z"] != null)
         {
             game_player_z = DataType.Instance.FillFloat(dict["game_player_z"]);
         }
     }
     if (dict.ContainsKey("game_player_x"))
     {
         if (dict["game_player_x"] != null)
         {
             game_player_x = DataType.Instance.FillFloat(dict["game_player_x"]);
         }
     }
     if (dict.ContainsKey("game_player_y"))
     {
         if (dict["game_player_y"] != null)
         {
             game_player_y = DataType.Instance.FillFloat(dict["game_player_y"]);
         }
     }
     if (dict.ContainsKey("network_port"))
     {
         if (dict["network_port"] != null)
         {
             network_port = DataType.Instance.FillInt(dict["network_port"]);
         }
     }
     if (dict.ContainsKey("game_players_allowed"))
     {
         if (dict["game_players_allowed"] != null)
         {
             game_players_allowed = DataType.Instance.FillInt(dict["game_players_allowed"]);
         }
     }
     if (dict.ContainsKey("game_type"))
     {
         if (dict["game_type"] != null)
         {
             game_type = DataType.Instance.FillString(dict["game_type"]);
         }
     }
     if (dict.ContainsKey("network_ip"))
     {
         if (dict["network_ip"] != null)
         {
             network_ip = DataType.Instance.FillString(dict["network_ip"]);
         }
     }
     if (dict.ContainsKey("network_use_nat"))
     {
         if (dict["network_use_nat"] != null)
         {
             network_use_nat = DataType.Instance.FillBoolean(dict["network_use_nat"]);
         }
     }
 }
Пример #38
0
 //when the ability is used increase the critical rate by 1//
 public void CharacterMana(float number)
 {
     manaCost                     = 150
                          ability = true;
 }
Пример #39
0
 public FileStorageProvider(File root, boolean clean) throws IOException {
Пример #40
0
 void Start()
 {
     gameOver = false;
 }
Пример #41
0
 public propertyDef()
 {
     this.ignoreTextField = boolean.False;
     this.textKindField   = propertyDefTextKind.Free;
     this.hiddenField     = "False";
 }
Пример #42
0
 private void restart()
 {
     //function to restart the level after losing
     gameOver = false;
     SceneManager.LoadScene(levelName);
 }
Пример #43
0
 public counter()
 {
     this.defaultField = "0";
     this.resetField   = boolean.True;
 }
Пример #44
0
 public CompleteTask(boolean endConversation = false)
 {
     this.endConversation = endConversation;
 }
Пример #45
0
        protected virtual void logMessage(int severity, String msg, Exception e, boolean bOutputOnly)
        {
            m_severity = severity;
		    if ( !isEnabled() )
			    return;
		
		    m_strMessage = "";
	        if ( getLogConf().isLogPrefix() )
	            addPrefix();
		
	        if ( msg != null )
	    	    m_strMessage += msg;
	    
	        if ( e != null )
	        {
	    	    m_strMessage += (msg != null && msg.length() > 0 ? ";" : "") + e.GetType().FullName + ": ";
	    	
	    	    String emsg = e.Message;
	    	    if ( emsg != null )
	    		    m_strMessage += emsg;

                String trace = e.StackTrace;
                if (trace != null)
                    m_strMessage += ";TRACE: \n" + trace;
	        }
	    
		    if (m_strMessage.length() > 0 || m_strMessage.charAt(m_strMessage.length() - 1) != '\n')
			    m_strMessage += '\n';
			
		    if ( bOutputOnly )
		    {
                getLogConf().getOutputSink().writeLogMessage(m_strMessage);
		    }else
		    {
		        lock( m_SinkLock ){
		    	    getLogConf().sinkLogMessage( m_strMessage, bOutputOnly );
		        }
		    }
	        if ( m_severity == L_FATAL )
	    	    processFatalError();
        }
Пример #46
0
        private String inputDigitWithOptionToRememberPosition(char nextChar, boolean rememberPosition)
        {
            accruedInput.append(nextChar);
            if (rememberPosition)
            {
                originalPosition = accruedInput.length();
            }
            // We do formatting on-the-fly only when each character entered is either a digit, or a plus
            // sign (accepted at the start of the number only).
            if (!isDigitOrLeadingPlusSign(nextChar))
            {
                ableToFormat       = false;
                inputHasFormatting = true;
            }
            else
            {
                nextChar = normalizeAndAccrueDigitsAndPlusSign(nextChar, rememberPosition);
            }
            if (!ableToFormat)
            {
                // When we are unable to format because of reasons other than that formatting chars have been
                // entered, it can be due to really long IDDs or NDDs. If that is the case, we might be able
                // to do formatting again after extracting them.
                if (inputHasFormatting)
                {
                    return(accruedInput.toString());
                }
                else if (attemptToExtractIdd())
                {
                    if (attemptToExtractCountryCallingCode())
                    {
                        return(attemptToChoosePatternWithPrefixExtracted());
                    }
                }
                else if (ableToExtractLongerNdd())
                {
                    // Add an additional space to separate long NDD and national significant number for
                    // readability. We don't set shouldAddSpaceAfterNationalPrefix to true, since we don't want
                    // this to change later when we choose formatting templates.
                    prefixBeforeNationalNumber.append(SEPARATOR_BEFORE_NATIONAL_NUMBER);
                    return(attemptToChoosePatternWithPrefixExtracted());
                }
                return(accruedInput.toString());
            }

            // We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits (the plus
            // sign is counted as a digit as well for this purpose) have been entered.
            switch (accruedInputWithoutFormatting.length())
            {
            case 0:
            case 1:
            case 2:
                return(accruedInput.toString());

            default:
                if (accruedInputWithoutFormatting.length() == 3)
                {
                    if (attemptToExtractIdd())
                    {
                        isExpectingCountryCallingCode = true;
                    }
                    else // No IDD or plus sign is found, might be entering in national format.
                    {
                        nationalPrefixExtracted = removeNationalPrefixFromNationalNumber();
                        return(attemptToChooseFormattingPattern());
                    }
                }
                if (isExpectingCountryCallingCode)
                {
                    if (attemptToExtractCountryCallingCode())
                    {
                        isExpectingCountryCallingCode = false;
                    }
                    return(prefixBeforeNationalNumber + nationalNumber.toString());
                }
                if (possibleFormats.size() > 0) // The formatting pattern is already chosen.
                {
                    String tempNationalNumber = inputDigitHelper(nextChar);
                    // See if the accrued digits can be formatted properly already. If not, use the results
                    // from inputDigitHelper, which does formatting based on the formatting pattern chosen.
                    String formattedNumber = attemptToFormatAccruedDigits();
                    if (formattedNumber.length() > 0)
                    {
                        return(formattedNumber);
                    }
                    narrowDownPossibleFormats(nationalNumber.toString());
                    if (maybeCreateNewTemplate())
                    {
                        return(inputAccruedNationalNumber());
                    }
                    return(ableToFormat
             ? appendNationalNumber(tempNationalNumber)
             : accruedInput.toString());
                }
                else
                {
                    return(attemptToChooseFormattingPattern());
                }
            }
        }
Пример #47
0
 public action()
 {
     this.defaultField = boolean.False;
 }
Пример #48
0
 public SyncSearchCommand(String from, String _params, Vector <String> arSources, boolean sync_changes, int nProgressStep) :
     base(scSearchOne, _params, nProgressStep, false)
 {
     m_strFrom      = from;
     m_bSyncChanges = sync_changes;
     m_arSources    = arSources;
 }
Пример #49
0
 public group()
 {
     this.orderedField = boolean.True;
     this.movetoField = boolean.True;
     this.collapsedField = boolean.False;
 }
Пример #50
0
 public static void doSyncAllSources(boolean bShowStatus)
 {
     getInstance().addQueueCommand(new SyncCommand(SyncThread.scSyncAll, bShowStatus));
 }
Пример #51
0
 public counter()
 {
     this.defaultField = "0";
     this.resetField = boolean.True;
 }
Пример #52
0
 public SyncCommand(int nCode, String strParam, boolean bShowStatus)
 {
     m_nCmdCode    = nCode;
     m_strCmdParam = strParam;
     m_bShowStatus = bShowStatus;
 }
Пример #53
0
 void statements(boolean cond, int x)
 {
     reg(new ISink() {
Пример #54
0
 public SyncCommand(int nCode, boolean bShowStatus)
 {
     m_nCmdCode    = nCode;
     m_nCmdParam   = 0;
     m_bShowStatus = bShowStatus;
 }
Пример #55
0
 public void setNonThreadedMode(boolean b){m_bNoThreaded = b;}
 public TextSectionDefinition(String name, Predicate <List <List <TextPosition> > > matchPredicate, MultiLine multiLine, boolean multiple)
 {
     this.name           = name;
     this.matchPredicate = matchPredicate;
     this.multiLine      = multiLine;
     this.multiple       = multiple;
 }
Пример #57
0
 /// <summary>
 /// 使用中のリソースをすべてクリーンアップします。
 /// </summary>
 /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
 protected override void Dispose( boolean disposing )
 {
     if ( disposing && (components != null) ) {
         components.Dispose();
     }
     base.Dispose( disposing );
 }
    }     // public void CheckWebservice()

    public void Shutdown()
    {
        _shutdown = true;
    }
Пример #59
0
 /**
  * Force loading a class. Consider using {@link #reload_classes(String[],
  * boolean)} for efficiency.
  * 
  * @see #reload_classes(String[], boolean)
  */
 public static void reload_class (String name, boolean resolve) 
Пример #60
0
            private void processDelete(String tableName, IDBResult rows2Delete, int[] cols)
            {
                if (tableName.equalsIgnoreCase("changed_values") || tableName.equalsIgnoreCase("sources") ||
                    tableName.equalsIgnoreCase("client_info"))
                {
                    return;
                }

                boolean bProcessTable = tableName.equalsIgnoreCase("object_values");
                boolean bSchemaSrc    = false;
                int     nSrcID        = 0;

                if (!bProcessTable)
                {
                    nSrcID        = m_db.getAttrMgr().getSrcIDHasBlobsByName(tableName);
                    bProcessTable = nSrcID != 0;
                    bSchemaSrc    = bProcessTable;
                }

                if (!bProcessTable)
                {
                    return;
                }

                if (!bSchemaSrc && !isChangedCol(cols, 3))         //value
                {
                    return;
                }

                for ( ; !rows2Delete.isEnd(); rows2Delete.next())
                {
                    if (!bSchemaSrc)
                    {
                        nSrcID = rows2Delete.getIntByIdx(0);

                        String attrib = rows2Delete.getStringByIdx(1);
                        String value  = rows2Delete.getStringByIdx(3);

                        //if (cols == null) //delete
                        //	m_db.getAttrMgr().remove(nSrcID, attrib);

                        if (m_db.getAttrMgr().isBlobAttr(nSrcID, attrib))
                        {
                            processBlobDelete(nSrcID, attrib, value);
                        }
                    }
                    else
                    {
                        Object[] data = rows2Delete.getCurData();
                        for (int i = 0; i < rows2Delete.getColCount(); i++)
                        {
                            if (!isChangedCol(cols, i))
                            {
                                continue;
                            }

                            String attrib = rows2Delete.getColName(i);
                            if (!(data[i] is String))
                            {
                                continue;
                            }

                            String value = (String)data[i];
                            if (m_db.getAttrMgr().isBlobAttr(nSrcID, attrib))
                            {
                                processBlobDelete(nSrcID, attrib, value);
                            }
                        }
                    }
                }
            }