Exemple #1
0
 public FlightControl(Vessel vessel)
 {
     rotation = new Vector(0, 0, 0);
     translation = new Vector(0, 0, 0);
     neutral = new Flushable<bool>();
     killRotation = new Flushable<bool>();
     bound = true;
     this.vessel = vessel;
     Vessel.OnFlyByWire += OnFlyByWire;
 }
Exemple #2
0
 public FlightControl(Vessel vessel)
 {
     rotation            = new Vector(0, 0, 0);
     translation         = new Vector(0, 0, 0);
     neutral             = new Flushable <bool>();
     killRotation        = new Flushable <bool>();
     bound               = true;
     this.vessel         = vessel;
     Vessel.OnFlyByWire += OnFlyByWire;
 }
Exemple #3
0
        public FlightControl(Vessel vessel)
        {
            neutral = new Flushable<bool>();
            killRotation = new Flushable<bool>();
            bound = false;
            Vessel = vessel;

            floatSuffixes = new List<string> { "YAW", "PITCH", "ROLL", "STARBOARD", "TOP", "FORE", "MAINTHROTTLE", "WHEELTHROTTLE", "WHEELSTEER" };
            vectorSuffixes = new List<string> { "ROTATION", "TRANSLATION" };
        }
Exemple #4
0
        public FlightControl(Vessel vessel)
        {
            neutral      = new Flushable <bool>();
            killRotation = new Flushable <bool>();
            bound        = false;
            Vessel       = vessel;

            floatSuffixes = new List <string> {
                "YAW", "PITCH", "ROLL", "STARBOARD", "TOP", "FORE", "MAINTHROTTLE", "WHEELTHROTTLE", "WHEELSTEER"
            };
            vectorSuffixes = new List <string> {
                "ROTATION", "TRANSLATION"
            };
        }
Exemple #5
0
 /// <summary>
 /// Flushes the given object. The same as calling <seealso cref="Flushable.flush()"/>, but
 /// errors while flushing are silently ignored.
 /// </summary>
 public static void flushSilently(Flushable flushable)
 {
     try
     {
         if (flushable != null)
         {
             flushable.flush();
         }
     }
     catch (IOException ignore)
     {
         LOG.debugCloseException(ignore);
     }
 }
Exemple #6
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.GetComponent <Flushable>() != null)
        {
            Flushable flushable = col.gameObject.GetComponent <Flushable>();

            if ((goodReceptacle && flushable.isGood == true) || (!goodReceptacle && flushable.isGood == false))
            {
                Score.AddScore(flushable.scoreValue);
                Debug.Log("score");
            }
            else
            {
                Timer.Penalty(flushable.time);
                Debug.Log("penalty");
            }
            Debug.Log(col.gameObject);
        }
    }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotCallTransactionClosedOnFailedForceLogToDisk() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotCallTransactionClosedOnFailedForceLogToDisk()
        {
            // GIVEN
            long   txId           = 3;
            string failureMessage = "Forces a failure";
            FlushablePositionAwareChannel channel = spy(new InMemoryClosableChannel());
            IOException failure = new IOException(failureMessage);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.io.Flushable flushable = mock(java.io.Flushable.class);
            Flushable flushable = mock(typeof(Flushable));

            doAnswer(invocation =>
            {
                invocation.callRealMethod();
                return(flushable);
            }).when(channel).prepareForFlush();
            doThrow(failure).when(flushable).flush();
            when(_logFile.Writer).thenReturn(channel);
            TransactionMetadataCache metadataCache      = new TransactionMetadataCache();
            TransactionIdStore       transactionIdStore = mock(typeof(TransactionIdStore));

            when(transactionIdStore.NextCommittingTransactionId()).thenReturn(txId);
            Mockito.reset(_databaseHealth);
            TransactionAppender appender = Life.add(new BatchingTransactionAppender(_logFiles, NO_ROTATION, metadataCache, transactionIdStore, BYPASS, _databaseHealth));

            // WHEN
            TransactionRepresentation transaction = mock(typeof(TransactionRepresentation));

            when(transaction.AdditionalHeader()).thenReturn(new sbyte[0]);
            try
            {
                appender.Append(new TransactionToApply(transaction), _logAppendEvent);
                fail("Expected append to fail. Something is wrong with the test itself");
            }
            catch (IOException e)
            {
                // THEN
                assertSame(failure, e);
                verify(transactionIdStore, times(1)).nextCommittingTransactionId();
                verify(transactionIdStore, never()).transactionClosed(eq(txId), anyLong(), anyLong());
                verify(_databaseHealth).panic(failure);
            }
        }
Exemple #8
0
        private static void Main()
        {
            // create bridge, with default setup
            // it will lookup jni4net.j.jar next to jni4net.n.dll
            Bridge.CreateJVM(new BridgeSetup()
            {
                Verbose = true
            });

            // here you go!
            [email protected]("Hello Java world!");

            // OK, simple hello is boring, let's play with Java properties
            // they are Hashtable realy
            Properties javaSystemProperties = java.lang.System.getProperties();

            // let's enumerate all keys.
            // We use Adapt helper to convert enumeration from java o .NET
            foreach (java.lang.String key in Adapt.Enumeration(javaSystemProperties.keys()))
            {
                [email protected](key);

                // this is automatic conversion of CLR string to java.lang.String
                [email protected](" : ");

                // we use the hashtable
                Object value = javaSystemProperties.get(key);

                // and this is CLR ToString() redirected to Java toString() method
                string valueToString = value.ToString();
                [email protected](valueToString);
            }

            // Java output is really Stream
            PrintStream stream = java.lang.System.@out;

            // it implements java.io.Flushable interface
            Flushable flushable = stream;

            flushable.flush();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToWriteACheckPoint() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToWriteACheckPoint()
        {
            // Given
            FlushablePositionAwareChannel channel = mock(typeof(FlushablePositionAwareChannel), RETURNS_MOCKS);
            Flushable flushable = mock(typeof(Flushable));

            when(channel.PrepareForFlush()).thenReturn(flushable);
            when(channel.PutLong(anyLong())).thenReturn(channel);
            when(_logFile.Writer).thenReturn(channel);
            BatchingTransactionAppender appender = Life.add(CreateTransactionAppender());

            // When
            appender.CheckPoint(new LogPosition(1L, 2L), LogCheckPointEvent.NULL);

            // Then
            verify(channel, times(1)).putLong(1L);
            verify(channel, times(1)).putLong(2L);
            verify(channel, times(1)).prepareForFlush();
            verify(flushable, times(1)).flush();
            verify(_databaseHealth, never()).panic(any());
        }
Exemple #10
0
 public long maybeLimitIO(long previousStamp, int recentlyCompletedIOs, Flushable flushable)
 {
     return(0);
 }
Exemple #11
0
        // The stamp is in two 32-bit parts:
        // The high bits are the number of IOs performed since the last pause.
        // The low bits is the 32-bit timestamp in milliseconds (~25 day range) since the last pause.
        // We keep adding summing up the IOs until either a quantum elapses, or we've exhausted the IOs we're allowed in
        // this quantum. If we've exhausted our IOs, we pause for the rest of the quantum.
        // We don't make use of the Flushable at this point, because IOs from fsyncs have a high priority, so they
        // might jump the IO queue and cause delays for transaction log IOs. Further, fsync on some file systems also
        // flush the entire IO queue, which can cause delays on IO rate limited cloud machines.
        // We need the Flushable to be implemented in terms of sync_file_range before we can make use of it.
        // NOTE: The check-pointer IOPS setting is documented as being a "best effort" hint. We are making use of that
        // wording here, and not compensating for over-counted IOs. For instance, if we receive 2 quantums worth of IOs
        // in one quantum, we are not going to sleep for two quantums. The reason is that such compensation algorithms
        // can easily over-compensate, and end up sleeping a lot more than what makes sense for other rate limiting factors
        // in the system, thus wasting IO bandwidth. No, "best effort" here means that likely end up doing a little bit
        // more IO than what we've been configured to allow, but that's okay. If it's a problem, people can just reduce
        // their IOPS limit setting a bit more.

        public override long MaybeLimitIO(long previousStamp, int recentlyCompletedIOs, Flushable flushable)
        {
            long state = _stateUpdater.get(this);

            if (GetDisabledCounter(state) > 0)
            {
                return(Org.Neo4j.Io.pagecache.IOLimiter_Fields.INITIAL_STAMP);
            }

            long now  = CurrentTimeMillis() & _timeMask;
            long then = previousStamp & _timeMask;

            if (now - then > QUANTUM_MILLIS)
            {
                return(now + ((( long )recentlyCompletedIOs) << TIME_BITS));
            }

            long ioSum = (previousStamp >> TIME_BITS) + recentlyCompletedIOs;

            if (ioSum >= GetIOPQ(state))
            {
                long millisLeftInQuantum = QUANTUM_MILLIS - (now - then);
                _pauseNanos.accept(this, TimeUnit.MILLISECONDS.toNanos(millisLeftInQuantum));
                return(CurrentTimeMillis() & _timeMask);
            }

            return(then + (ioSum << TIME_BITS));
        }