예제 #1
0
파일: MultiSearcher.cs 프로젝트: sinsay/SSE
        /// <summary>Creates a searcher which searches <i>searchers</i>. </summary>
        public MultiSearcher(Searchable[] searchables)
        {
            this.searchables = searchables;

            starts = new int[searchables.Length + 1]; // build starts array
            for (int i = 0; i < searchables.Length; i++)
            {
                starts[i] = maxDoc;
                maxDoc += searchables[i].MaxDoc(); // compute maxDocs
            }
            starts[searchables.Length] = maxDoc;
        }
        public void ShouldAddAndGetLaw()
        {
            Searchable _shab = new Searchable();

            _shab.LawId = 123;
            _shab.SolrId = "Law123";
            _shab.Title = "Money for everybody.";
            _shab.DocType = "Law";

            solr_searchable.Add(_shab).Commit();

            var results = solr_searchable.Query("solr_id:Law123");
            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("Money for everybody.", results.First().Title);
        }
예제 #3
0
 public IntersectionCollector(Searchable indexSearcher, IEnumerable<ScoreDoc> scoreDocs)
 {
     foreach (var scoreDoc in scoreDocs)
     {
         var document = indexSearcher.Doc(scoreDoc.Doc);
         var subQueryResult = new SubQueryResult
         {
             LuceneId = scoreDoc.Doc,
             RavenDocId = document.Get(Constants.DocumentIdFieldName) ?? document.Get(Constants.ReduceKeyFieldName),
             Score = float.IsNaN(scoreDoc.Score) ? 0.0f : scoreDoc.Score,
             Count = 1
         };
         results[subQueryResult.RavenDocId] = subQueryResult;
     }
 }
예제 #4
0
        public SearchResult<UserMaster> Search(Searchable<UserMasterSearcher> criteria)
        {
            var result = new SearchResult<UserMaster>();
            result.Items = new List<UserMaster>()
            {
                new UserMaster
                {
                    UserIdentifier = "b55",
                    UserNumber = 55,
                    Name = "Billy",
                    EmailAddress = "*****@*****.**",
                    Fax = "N/A",
                    Mobile = "N/A",
                    Phone = "N/A",
                    PrimaryBranchNumber = 123,
                },
                new UserMaster
                {
                    UserIdentifier = "c22",
                    UserNumber = 22,
                    Name = "Charles Carmichael",
                    EmailAddress = "*****@*****.**",
                    Fax = "N/A",
                    Mobile = "N/A",
                    Phone = "N/A",
                    PrimaryBranchNumber = 007,
                }
            };
            result.TotalRecords = result.Items.Count;

            result.ResultOffset = Helper.GetOffset(0, result.TotalRecords);
            result.TotalRecords = Helper.ClampCount(criteria.searchRange.Offset, criteria.searchRange.Size, result.TotalRecords);
            HttpUtils.Response.setupCurrentWebResponseNoCache();
            return result;

            //return QueryHelper.ApplyGenericSearch(PowerScopeDataStores.UserMaster, Logger, SearchMethodName, criteria, "UserIdentifier", this.ConstructQueryConditions);
        }
예제 #5
0
 public BagTypeTagsTests()
 {
     BagType           = new BagType(System.Guid.NewGuid().ToString(), "Paper");
     SearchableBagType = new Searchable(BagType);
 }
 public override bool open(Searchable config)
 {
     bool ret = yarpPINVOKE.DeviceDriver_open(swigCPtr, Searchable.getCPtr(config));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public override List <Searchable> getPathToDataControl(Searchable dataControl)
 {
     return(getPathFromChild(dataControl, globalStatesDataControlList.Cast <Searchable>().ToList()));
 }
예제 #8
0
파일: Deer.cs 프로젝트: taekong423/GgumGate
 public DeerAttackState(Enemy enemy, Searchable searchable) : base(enemy, searchable)
 {
     _deer = enemy as Deer;
 }
예제 #9
0
 public override List <Searchable> getPathToDataControl(Searchable dataControl)
 {
     return(dataControl == this ? new List <Searchable> {
         this
     } : null);
 }
예제 #10
0
 public SearchResult<Customer> Search(Searchable<CustomerSearcher> searchData)
 {
     return QueryHelper.ApplyGenericSearch(HDSMobileAppDataStores.Customer, Logger, SearchMethodName, searchData.searchRange, searchData.searchCriteria, "customerId", this.ConstructQueryConditions);
 }
예제 #11
0
 public override List <Searchable> getPathToDataControl(Searchable dataControl)
 {
     return(null);
 }
예제 #12
0
 public ChaseState(Enemy enemy, Searchable searchable) : base(enemy, searchable)
 {
     CurrentState = "Chase";
 }
예제 #13
0
 public BrandTagsTests()
 {
     Brand           = new Brand(System.Guid.NewGuid().ToString(), "Twinning");
     SearchableBrand = new Searchable(Brand);
 }
예제 #14
0
 public IdleState(Enemy enemy, Searchable searchable) : base(enemy, searchable)
 {
     CurrentState = "Idle";
 }
예제 #15
0
    //Collect Pickups and search and attack things
    public void OnTriggerEnter2D(Collider2D collision)
    {
        //Debug.Log("Enter Trigger with" + collision.transform.gameObject);

        if (_wantToAttack && _AttackTarget != null)
        {
            if (collision.gameObject.transform.parent)
            {
                print("ATTACK$44?");
                if (collision.gameObject.transform.parent.gameObject == _AttackTarget)
                {
                    Attack();
                }
            }
        }
        else if (_MoveLocation == collision.gameObject)
        {
            _horizontalMove = 0;
        }


        if (collision.transform.GetComponent <DiggableTile>())
        {
            // Debug.Log("Collider w diggable tile");
            if (!_InGround) // only keep track of top soil tiles
            {
                _CurrentSoilTile = collision.transform.GetComponent <DiggableTile>();
            }
        }
        else if (collision.transform.parent)
        {
            // handle if collider is agro range or base range
            if (collision.transform.GetComponent <BaseHitBox>())
            {
                //print("Collided with a  base hitbox");
                if (collision.transform.parent.GetComponent <BuildableObject>())
                {
                    // print("collded with a buildng hitbox");
                    //Add to our list of interactable things in range
                    _InRange.Add(collision.transform.parent.gameObject);
                    //print("Added: " + collision.transform.parent.gameObject);
                    //Can we search it?
                    if (collision.transform.parent.GetComponent <Searchable>())
                    {
                        Searchable s = collision.transform.parent.GetComponent <Searchable>();
                        {
                            s.setActive(true);
                            // Debug.LogWarning("Players in range");
                        }
                    }
                }

                else if (collision.transform.parent.GetComponent <Rodent>())
                {
                    //Add to our list of interactable things in range
                    Rodent r = collision.transform.parent.GetComponent <Rodent>();
                    if (r.getTeam() == 2 && _InRange.Contains(collision.transform.parent.gameObject) == false)
                    {
                        _InRange.Add(collision.transform.parent.gameObject);
                    }
                }
            }
        }

        ///Old Game Jam code, could be reused for pickups
        else if (collision.transform.GetComponent <CoinResource>())
        {
            // if (collision.transform.GetComponent<CoinResource>().isActive())
            {
                ResourceManagerScript.Instance.incrementResource(ResourceManagerScript.ResourceType.Trash, 1);
                Destroy(collision.gameObject);
            }
        }
    }
예제 #16
0
 private static IEnumerable <SearchResult> MapLuceneToDataList(IEnumerable <ScoreDoc> hits, Searchable searcher)
 {
     return(hits.Select(hit => ToSearchResult(searcher.Doc(hit.Doc))).ToList());
 }
예제 #17
0
파일: Deer.cs 프로젝트: taekong423/GgumGate
 public RestState(Enemy enemy, Searchable searchable) : base(enemy, searchable)
 {
     CurrentState = "Rest";
 }
예제 #18
0
파일: Deer.cs 프로젝트: taekong423/GgumGate
 public DeerMoveState(Enemy enemy, Searchable searchable) : base(enemy, searchable)
 {
 }
예제 #19
0
 public virtual bool open(Searchable config)
 {
     return true;
 }
 public virtual bool open(Searchable config)
 {
     if(initialised)
     { return true;}
     else{ return false;}
 }
예제 #21
0
 private static IEnumerable <Guid> _mapLuceneToDataList(IEnumerable <ScoreDoc> hits, Searchable searcher)
 {
     return(hits.Select(hit => _mapLuceneDocumentToData(searcher.Doc(hit.Doc))).ToList());
 }
예제 #22
0
 public MoveState(Enemy enemy, Searchable searchable) : base(enemy, searchable)
 {
     CurrentState = "Move";
 }
 public MultiSearcherThread(Searchable searchable, Weight weight, Filter filter, int nDocs, FieldDocSortedHitQueue hq, Sort sort, int i, int[] starts, System.String name)
     : base(name)
 {
     this.searchable = searchable;
     this.weight = weight;
     this.filter = filter;
     this.nDocs = nDocs;
     this.hq = hq;
     this.i = i;
     this.starts = starts;
     this.sort = sort;
 }
예제 #24
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("Square(");
        bool __first = true;

        if (Mid != null && __isset.mid)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Mid: ");
            Mid.ToString(sb);
        }
        if (Name != null && __isset.name)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Name: ");
            Name.ToString(sb);
        }
        if (WelcomeMessage != null && __isset.welcomeMessage)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("WelcomeMessage: ");
            WelcomeMessage.ToString(sb);
        }
        if (ProfileImageObsHash != null && __isset.profileImageObsHash)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ProfileImageObsHash: ");
            ProfileImageObsHash.ToString(sb);
        }
        if (Desc != null && __isset.desc)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Desc: ");
            Desc.ToString(sb);
        }
        if (__isset.searchable)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Searchable: ");
            Searchable.ToString(sb);
        }
        if (__isset.type)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Type: ");
            Type.ToString(sb);
        }
        if (__isset.categoryID)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CategoryID: ");
            CategoryID.ToString(sb);
        }
        if (InvitationURL != null && __isset.invitationURL)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("InvitationURL: ");
            InvitationURL.ToString(sb);
        }
        if (__isset.revision)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Revision: ");
            Revision.ToString(sb);
        }
        if (__isset.ableToUseInvitationTicket)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("AbleToUseInvitationTicket: ");
            AbleToUseInvitationTicket.ToString(sb);
        }
        if (__isset.state)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("State: ");
            State.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
예제 #25
0
 public CountryTagsTests()
 {
     Country           = new Country(System.Guid.NewGuid().ToString(), "Norway");
     SearchableCountry = new Searchable(Country);
 }
예제 #26
0
 internal static HandleRef getCPtr(Searchable obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
예제 #27
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Searchable obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
예제 #28
0
 public PolyDriver(Searchable config)
     : this(yarpPINVOKE.new_PolyDriver__SWIG_2(Searchable.getCPtr(config)), true)
 {
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #29
0
파일: Drivers.cs 프로젝트: johnty/YarpUnity
 public virtual DeviceDriver open(Searchable config)
 {
     IntPtr cPtr = yarpPINVOKE.Drivers_open__SWIG_1(swigCPtr, Searchable.getCPtr(config));
     DeviceDriver ret = (cPtr == IntPtr.Zero) ? null : new DeviceDriver(cPtr, false);
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
예제 #30
0
 public SearchResult<Product> Search(Searchable<ProductSearcher> searchData)
 {
     return QueryHelper.ApplyGenericSearch(HDSMobileAppDataStores.Product, Logger, SearchMethodName, searchData.searchRange, searchData.searchCriteria, "productId", this.ConstructQueryConditions);
 }
예제 #31
0
 public virtual bool open(Searchable config)
 {
     bool ret = yarpPINVOKE.IConfig_open(swigCPtr, Searchable.getCPtr(config));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
예제 #32
0
 public void fromConfig(string txt, Searchable env)
 {
     yarpPINVOKE.Property_fromConfig__SWIG_3(swigCPtr, txt, Searchable.getCPtr(env));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
        private IEnumerable <T> EnumerateHits <T>(TopDocs hits, QueryExecutionContext executionContext, Searchable searcher, IRetrievedDocumentTracker <TDocument> tracker, ItemHolder itemHolder, int skipResults, Func <TDocument, T> projector)
        {
            for (var i = skipResults; i < hits.ScoreDocs.Length; i++)
            {
                executionContext.CurrentHit      = i;
                executionContext.CurrentScoreDoc = hits.ScoreDocs[i];

                var docNum   = hits.ScoreDocs[i].Doc;
                var document = searcher.Doc(docNum);

                if (tracker == null)
                {
                    itemHolder.Current = ConvertDocument(document, executionContext);
                    yield return(projector(itemHolder.Current));

                    continue;
                }

                var key = GetDocumentKey(document, executionContext);

                if (tracker.IsMarkedForDeletion(key))
                {
                    continue;
                }

                TDocument item;
                if (!tracker.TryGetTrackedDocument(key, out item))
                {
                    item = ConvertDocument(document, executionContext);
                    tracker.TrackDocument(key, item, document);
                }

                itemHolder.Current = item;
                yield return(projector(itemHolder.Current));
            }
        }
예제 #34
0
 public bool fromConfigFile(string fname, Searchable env)
 {
     bool ret = yarpPINVOKE.Property_fromConfigFile__SWIG_3(swigCPtr, fname, Searchable.getCPtr(env));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
예제 #35
0
 public SearchResult<SalesTerritory> Search(Searchable<SalesTerritorySearcher> searchData)
 {
     return QueryHelper.ApplyGenericSearch(HDSMobileAppDataStores.SalesTerritory, Logger, SearchMethodName, searchData.searchRange, searchData.searchCriteria, "territoryId", this.ConstructQueryConditions);
 }
예제 #36
0
    // used to be from MVC controller to let the building know its been clicked
    public void imClicked()
    {
        if (_Team == 2)
        {
            return;
        }
        // Debug.Log("Building is Clicked state is" + eState);
        if (eState == BuildingState.Built)
        {
            //Create a new menu interaction on a built object, downgrade? Demolish? Show resource output etc. Needs Something
            if (eType == BuildingType.GarbageCan || eType == BuildingType.WoodPile || eType == BuildingType.StonePile)
            {
                if (getEmployeeCount() == 0) // if someone is working here, player cant gather
                {
                    //Debug.Log("I am gathering!");
                    Searchable s = GetComponent <Searchable>();
                    if (s)
                    {
                        // s.GatherAction(20);
                        s.ImClicked(); // should use ImClicked instead of GatherAction and encapsulate gather action into searchables functionality
                    }
                }
            }
            else if (eType == BuildingType.Outpost && _cameraController.getOverrideMode())
            {
                bOutpost outpost = GetComponent <bOutpost>();
                if (outpost.getSelected())
                {
                    setOutlineSelected();
                    UITroopSelection.Instance.addTroops(getEmployeeCount());
                }
                else
                {
                    setOutlineAvailable();
                    UITroopSelection.Instance.addTroops(0 - getEmployeeCount());
                }
            }
            else
            {
                StartCoroutine(ClickDelay(true, _DestroyMenu));
                StartCoroutine(ClickDelay(false, _BuildMenu));
                StartCoroutine(ClickDelay(false, _BuildingCapMenu));
            }
        }
        else if (eState == BuildingState.Available || eState == BuildingState.Idle)
        {
            // Turns off the "notification exclamation mark" as the player is now aware of obj
            eState = BuildingState.Idle;

            //check if we can afford a building slot
            if (ResourceManagerScript.Instance.getNoBuildingSlots() < GameManager.Instance.GetBuildingCap())
            {
                StartCoroutine(ClickDelay(true, _BuildMenu));
            }
            else
            {
                //TO-DO: Show new menu that tells player at cap and to upgrade TC
                StartCoroutine(ClickDelay(true, _BuildingCapMenu));
            }
            StartCoroutine(ClickDelay(false, _DestroyMenu));

            //Disconnect here, MVC controller is now responsible for talking to UI
        }
        else if (eState == BuildingState.Building)
        {
            //IncrementConstruction(1);
            //Show a menu that asks to spend a shiny to increment
            _InstanceConstructionButton.SetActive(true);
            MVCController.Instance.setLastInstantConstruction(_InstanceConstructionButton);
        }

        if (!_cameraController.getOverrideMode())
        {
            UpdateState();
        }
    }
 public override List <Searchable> getPathToDataControl(Searchable dataControl)
 {
     return(getPathFromChild(dataControl, exitsDataControlList.Cast <System.Object>().ToList()));
 }
예제 #38
0
        public SearchForm(Searchable searchable)
        {
            InitializeComponent();

            this.searchable = searchable;
        }
예제 #39
0
 public AttackState(Enemy enemy, Searchable searchable) : base(enemy, searchable)
 {
     CurrentState = "Attack";
 }
예제 #40
0
    public override List <Searchable> getPathToDataControl(Searchable dataControl)
    {
        List <Searchable> path = getPathFromSearchableChild(dataControl, exitLookDataControl);

        return(path);
    }
예제 #41
0
 public override List <Searchable> getPathToDataControl(Searchable dataControl)
 {
     return(getPathFromChild(dataControl, conversationsDataControlList.Cast <Searchable>().ToList()));
 }
예제 #42
0
 public HitState(Enemy enemy, float keepTime, float delay, Searchable searchable) : base(enemy, searchable)
 {
     CurrentState = "Hit";
     _keepTime    = keepTime;
     _delay       = delay;
 }
 /// <summary>Creates a searchable which searches <i>searchables</i>. </summary>
 public ParallelMultiSearcher(Searchable[] searchables)
     : base(searchables)
 {
     this.searchables = searchables;
     this.starts = GetStarts();
 }
예제 #44
0
 public SearchResult<Person> Search(Searchable<PersonSearcher> searchData)
 {
     return QueryHelper.ApplyGenericSearch(HDSMobileAppDataStores.Person, Logger, SearchMethodName, searchData.searchRange, searchData.searchCriteria, "businessEntityId", this.ConstructQueryConditions);
 }
예제 #45
0
 public EnemyState(Enemy enemy, Searchable searchable = null) : base(enemy)
 {
     _enemy      = enemy;
     _searchable = searchable;
 }
예제 #46
0
파일: Index.cs 프로젝트: jon-adams/ravendb
			public DuplicateDocumentRecorder(Searchable indexSearcher,
				Index parent,
				HashSet<string> documentsAlreadySeenInPreviousPage,
				HashSet<RavenJObject> alreadyReturned,
				FieldsToFetch fieldsToFetch,
				bool isProjectionOrMapReduce)
			{
				this.indexSearcher = indexSearcher;
				this.parent = parent;
				this.isProjectionOrMapReduce = isProjectionOrMapReduce;
				this.alreadyReturned = alreadyReturned;
				this.fieldsToFetch = fieldsToFetch;
				this.documentsAlreadySeenInPreviousPage = documentsAlreadySeenInPreviousPage;
			}
예제 #47
0
        private IList<int> BuildSearchResult(TopDocs topDocs, Searchable indexSearcher)
        {
            var total = topDocs.TotalHits;
            var result = new List<int>();

            for (int i = 0; i < total; i++)
            {
                if (i == this.configuracoesDaAplicacao.ResultadoMaximoConsulta)
                {
                    break;
                }

                var docIndex = topDocs.ScoreDocs[i].Doc;
                var doc = indexSearcher.Doc(docIndex);
                result.Add(doc.Get("documentoId").ToInt());
            }

            return result;
        }
    /*
    Open the device driver and start communication with the hardware.
    @param config is a Searchable object containing the list of parameters.
    @return true on success/failure.
    */
    bool open(Searchable config)
    {
        Searchable p = config;
        if (!p.check ("GENERAL", "section for general motor control parameters")) {
            Debug.Log ("Cannot understand configuration parameters");
            return false;
        }

        //int TypeArm = p.findGroup("GENERAL").check("Type",Value(1),"what did the user select?").asInt();
        //Debug.Log (TypeArm);
        return true;
    }
예제 #49
0
 private static IEnumerable<Guid> _mapLuceneToDataList(IEnumerable<ScoreDoc> hits, Searchable searcher)
 {
     return hits.Select(hit => _mapLuceneDocumentToData(searcher.Doc(hit.Doc))).ToList();
 }
예제 #50
0
    public virtual Searchable getConnectionModifiers()
    {
        Searchable ret = new Searchable(yarpPINVOKE.ConnectionReader_getConnectionModifiers(swigCPtr), false);

        return(ret);
    }
예제 #51
0
 public override List <Searchable> getPathToDataControl(Searchable dataControl)
 {
     throw new NotImplementedException();
 }
예제 #52
0
 public CinematicState(Enemy enemy, Searchable searchable) : base(enemy, searchable)
 {
 }
예제 #53
0
		public override void  SetUp()
		{
			base.SetUp();
			// create MultiSearcher from two seperate searchers
			Directory d1 = new RAMDirectory();
			IndexWriter iw1 = new IndexWriter(d1, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
			AddCollection1(iw1);
			iw1.Close();
			Directory d2 = new RAMDirectory();
			IndexWriter iw2 = new IndexWriter(d2, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
			AddCollection2(iw2);
			iw2.Close();
			
			Searchable[] s = new Searchable[2];
			s[0] = new IndexSearcher(d1);
			s[1] = new IndexSearcher(d2);
			multiSearcher = new MultiSearcher(s);
			
			// create IndexSearcher which contains all documents
			Directory d = new RAMDirectory();
			IndexWriter iw = new IndexWriter(d, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
			AddCollection1(iw);
			AddCollection2(iw);
			iw.Close();
			singleSearcher = new IndexSearcher(d);
		}
예제 #54
0
 public abstract List <Searchable> getPathToDataControl(Searchable dataControl);