Examples of Index


Examples of org.ardverk.dht.storage.Index

  public void add() throws Exception {
   
    final int count = 10;
   
    File dir = new File("data/test");
    Index index = DefaultIndex.create(dir);
   
    Set<KUID> dst = new TreeSet<KUID>();
    Key key = KeyFactory.parseKey("ardverk:///hello/world");
    for (int i = 0; i < count; i++) {
      KUID valueId = KUID.createRandom(key.getId());
      Context context = new Context();
      context.addHeader("X-Index", Integer.toString(i));
     
      index.add(key, context, valueId);
      dst.add(valueId);
    }
   
    final int m = dst.size()/2-1;
    final int maxCount = 6;
   
    KUID marker = CollectionUtils.nth(dst, m);
    Values values = index.values(key, marker, maxCount);
   
    TestCase.assertEquals(marker, values.firstKey());
    TestCase.assertTrue(values.size() <= maxCount);
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.core.index.Index

  public boolean execute(IProgressMonitor progressMonitor) {

    if (this.isCancelled || progressMonitor != null && progressMonitor.isCanceled()) return true;

    /* ensure no concurrent write access to index */
    Index index = this.manager.getIndex(this.containerPath, true, /*reuse index file*/ false /*create if none*/);
    if (index == null) return true;
    ReadWriteMonitor monitor = index.monitor;
    if (monitor == null) return true; // index got deleted since acquired

    try {
      monitor.enterRead(); // ask permission to read
      String containerRelativePath = Util.relativePath(this.folderPath, this.containerPath.segmentCount());
      String[] paths = index.queryDocumentNames(containerRelativePath);
      // all file names belonging to the folder or its subfolders and that are not excluded (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=32607)
      if (paths != null) {
        if (this.exclusionPatterns == null && this.inclusionPatterns == null) {
          for (int i = 0, max = paths.length; i < max; i++) {
            manager.remove(paths[i], this.containerPath); // write lock will be acquired by the remove operation
View Full Code Here

Examples of org.assertj.core.data.Index

  @Test
  public void should_fail_if_actual_does_not_contain_value_at_index() {
    AssertionInfo info = someInfo();
    boolean value = true;
    Index index = atIndex(1);
    try {
      arrays.assertContains(info, actual, value, index);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldContainAtIndex(actual, value, index, false));
      return;
View Full Code Here

Examples of org.bigbluebutton.webminer.index.Index

     * First arg is the name of the input SWF file
     * If second arg exists then actions are decompiled - the arg is ignored
     */
    public static void main( String[] args ) throws IOException
    {
        Index index = Index.getInstance();
        //index.addIndex("test","test title");
       
    }
View Full Code Here

Examples of org.codehaus.aspectwerkz.extension.persistence.Index

        KeyObject[] keyArray = new KeyObject[m_indexDefinitions.size()];

        int i = 0;
        for (Iterator it = keys.iterator(); it.hasNext(); i++) {
            try {
                final Index index = (Index)it.next();

                final Method method = index.getMethod();
                final Class indexFieldType = index.getFieldType();
                final Class indexType = (Class)m_jispIndexTypes.get(index.getIndexName());

                final Object indexFieldValue = method.invoke(obj, new Object[]{});

                ObjectFactory factory = new DefaultObjectFactory(
                        indexType,
View Full Code Here

Examples of org.datanucleus.store.rdbms.key.Index

                {
                    JavaTypeMapping embFieldMapping = embMapping.getJavaTypeMapping(i);
                    IndexMetaData imd = embFieldMapping.getMemberMetaData().getIndexMetaData();
                    if (imd != null)
                    {
                        Index index = TableUtils.getIndexForField(this, imd, embFieldMapping);
                        if (index != null)
                        {
                            indices.add(index);
                        }
                    }
                }
            }
            else if (fieldMapping instanceof SerialisedMapping)
            {
                // Don't index these
            }
            else
            {
                // Add any required index for this field
                IndexMetaData imd = fmd.getIndexMetaData();
                if (imd != null)
                {
                    // Index defined so add it
                    Index index = TableUtils.getIndexForField(this, imd, fieldMapping);
                    if (index != null)
                    {
                        indices.add(index);
                    }
                }
                else if (autoMode)
                {
                    if (fmd.getIndexed() == null)
                    {
                        // Indexing not set, so add where we think it is appropriate
                        if (!fmd.isPrimaryKey()) // Ignore PKs since they will be indexed anyway
                        {
                            int relationType = fmd.getRelationType(clr);
                            if (relationType == Relation.ONE_TO_ONE_UNI)
                            {
                                // 1-1 with FK at this side so index the FK
                                if (fieldMapping instanceof ReferenceMapping)
                                {
                                    ReferenceMapping refMapping = (ReferenceMapping)fieldMapping;
                                    if (refMapping.getMappingStrategy() == ReferenceMapping.PER_IMPLEMENTATION_MAPPING)
                                    {
                                        // Cols per implementation : index each of implementations
                                        if (refMapping.getJavaTypeMapping() != null)
                                        {
                                            int colNum = 0;
                                            JavaTypeMapping[] implMappings = refMapping.getJavaTypeMapping();
                                            for (int i=0;i<implMappings.length;i++)
                                            {
                                                int numColsInImpl = implMappings[i].getNumberOfDatastoreMappings();
                                                Index index = new Index(this, false, null);
                                                for (int j=0;j<numColsInImpl;j++)
                                                {
                                                    index.setColumn(j,
                                                        (Column)fieldMapping.getDatastoreMapping(colNum++).getDatastoreField());
                                                }
                                                indices.add(index);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    Index index = new Index(this, false, null);
                                    for (int i=0;i<fieldMapping.getNumberOfDatastoreMappings();i++)
                                    {
                                        index.setColumn(i, (Column)fieldMapping.getDatastoreMapping(i).getDatastoreField());
                                    }
                                    indices.add(index);
                                }
                            }
                            else if (relationType == Relation.ONE_TO_ONE_BI && fmd.getMappedBy() == null)
                            {
                                // 1-1 with FK at this side so index the FK
                                Index index = new Index(this, false, null);
                                for (int i=0;i<fieldMapping.getNumberOfDatastoreMappings();i++)
                                {
                                    index.setColumn(i, (Column)fieldMapping.getDatastoreMapping(i).getDatastoreField());
                                }
                                indices.add(index);
                            }
                            else if (relationType == Relation.MANY_TO_ONE_BI)
                            {
                                // N-1 with FK at this side so index the FK
                                AbstractMemberMetaData relMmd = fmd.getRelatedMemberMetaData(clr)[0];
                                if (relMmd.getJoinMetaData() == null && fmd.getJoinMetaData() == null)
                                {
                                    Index index = new Index(this, false, null);
                                    for (int i=0;i<fieldMapping.getNumberOfDatastoreMappings();i++)
                                    {
                                        index.setColumn(i, (Column)fieldMapping.getDatastoreMapping(i).getDatastoreField());
                                    }
                                    indices.add(index);
                                }
                            }
                        }
                    }
                }
            }
        }

        // Check if any version column needs indexing
        if (versionMapping != null)
        {
            IndexMetaData idxmd = getVersionMetaData().getIndexMetaData();
            if (idxmd != null)
            {
                Index index = new Index(this, idxmd.isUnique(),
                    idxmd.getValueForExtension("extended-setting"));
                if (idxmd.getName() != null)
                {
                    index.setName(idxmd.getName());
                }
                int countVersionFields = versionMapping.getNumberOfDatastoreMappings();
                for (int i=0; i<countVersionFields; i++)
                {
                    index.addDatastoreField(versionMapping.getDatastoreMapping(i).getDatastoreField());
                }
                indices.add(index);
            }
        }

        // Check if any discriminator column needs indexing
        if (discriminatorMapping != null)
        {
            DiscriminatorMetaData dismd = getDiscriminatorMetaData();
            IndexMetaData idxmd = dismd.getIndexMetaData();
            if (idxmd != null)
            {
                Index index = new Index(this, idxmd.isUnique(),
                    idxmd.getValueForExtension("extended-setting"));
                if (idxmd.getName() != null)
                {
                    index.setName(idxmd.getName());
                }
                int countDiscrimFields = discriminatorMapping.getNumberOfDatastoreMappings();
                for (int i=0; i<countDiscrimFields; i++)
                {
                    index.addDatastoreField(discriminatorMapping.getDatastoreMapping(i).getDatastoreField());
                }
                indices.add(index);
            }
        }

        // Add on any order fields (for lists, arrays, collections) that need indexing
        Set orderMappingsEntries = getExternalOrderMappings().entrySet();
        Iterator orderMappingsEntriesIter = orderMappingsEntries.iterator();
        while (orderMappingsEntriesIter.hasNext())
        {
            Map.Entry entry = (Map.Entry)orderMappingsEntriesIter.next();
            AbstractMemberMetaData fmd = (AbstractMemberMetaData)entry.getKey();
            JavaTypeMapping mapping = (JavaTypeMapping)entry.getValue();
            OrderMetaData omd = fmd.getOrderMetaData();
            if (omd != null && omd.getIndexMetaData() != null)
            {
                Index index = getIndexForIndexMetaDataAndMapping(omd.getIndexMetaData(), mapping);
                if (index != null)
                {
                    indices.add(index);
                }
            }
        }

        // Add on any user-required indices for the class(es) as a whole (subelement of <class>)
        Iterator<AbstractClassMetaData> cmdIter = managedClassMetaData.iterator();
        while (cmdIter.hasNext())
        {
            AbstractClassMetaData thisCmd = cmdIter.next();
            IndexMetaData[] classIndices = thisCmd.getIndexMetaData();
            if (classIndices != null)
            {
                for (int i=0;i<classIndices.length;i++)
                {
                    Index index = getIndexForIndexMetaData(classIndices[i]);
                    if (index != null)
                    {
                        indices.add(index);
                    }
                }
View Full Code Here

Examples of org.drools.core.util.AbstractHashTable.Index

        if ( indexedPositions.length > 0 ) {
            if (((IndexableConstraint)constraints[indexedPositions[0]]).getConstraintType() == ConstraintType.EQUAL) {
                LeftTupleIndexHashTable tupleHashTable = (LeftTupleIndexHashTable) betaMemory.getLeftTupleMemory();
                assertTrue( tupleHashTable.isIndexed() );
                Index index = tupleHashTable.getIndex();

                for ( int i = 0; i < indexedPositions.length; i++ ) {
                    checkSameConstraintForIndex( (IndexableConstraint)constraints[indexedPositions[i]],
                                                 index.getFieldIndex( i ) );
                }

                RightTupleIndexHashTable factHashTable = (RightTupleIndexHashTable) betaMemory.getRightTupleMemory();
                assertTrue( factHashTable.isIndexed() );
                index = factHashTable.getIndex();

                for ( int i = 0; i < indexedPositions.length; i++ ) {
                    checkSameConstraintForIndex( (IndexableConstraint)constraints[indexedPositions[i]],
                                                 index.getFieldIndex( i ) );
                }
            } else {

            }
        } else {
View Full Code Here

Examples of org.drools.util.AbstractHashTable.Index

        BetaMemory betaMemory = betaConstraints.createBetaMemory( config );

        if ( indexedPositions.length > 0 ) {
            LeftTupleIndexHashTable tupleHashTable = (LeftTupleIndexHashTable) betaMemory.getLeftTupleMemory();
            assertTrue( tupleHashTable.isIndexed() );
            Index index = tupleHashTable.getIndex();

            for ( int i = 0; i < indexedPositions.length; i++ ) {
                checkSameConstraintForIndex( constraints[indexedPositions[i]],
                                             index.getFieldIndex( i ) );
            }

            RightTupleIndexHashTable factHashTable = (RightTupleIndexHashTable) betaMemory.getRightTupleMemory();
            assertTrue( factHashTable.isIndexed() );
            index = factHashTable.getIndex();

            for ( int i = 0; i < indexedPositions.length; i++ ) {
                checkSameConstraintForIndex( constraints[indexedPositions[i]],
                                             index.getFieldIndex( i ) );
            }
        } else {
            LeftTupleList tupleHashTable = (LeftTupleList) betaMemory.getLeftTupleMemory();
            assertFalse( tupleHashTable.isIndexed() );
View Full Code Here

Examples of org.eclipse.dltk.core.search.index.Index

  public static void printIndexDebugInfo(IProject prj) throws Exception {
   
    System.out.println("========= Index DEBUG INFO ========");
   
    IndexManager im = org.eclipse.dltk.internal.core.ModelManager.getModelManager().getIndexManager();
    Index idx = im.getIndex(prj.getFullPath(), true, true); // This is index file for project root
   
    assertNotNull(im.indexLocations.keyTable);
    System.out.println("===== Index Locations ====\n" + im.indexLocations + "\n");
   
    im.waitUntilReady();
   
    // And then check using
    String[] docNames = idx.queryDocumentNames(null); // To check all documents in this index
    assertNotNull(docNames);
    System.out.println("===== Index docs ====\n" + StringUtil.collToString(docNames, "\n") );
   
    System.out.println("===== Query: Type Decl, * ====");
    debugPrintCategory(idx, IIndexConstants.TYPE_DECL);
View Full Code Here

Examples of org.eclipse.help.internal.index.Index

    while (iter.hasNext()) {
      IndexEntry entry = extractEnabled((IndexEntry)iter.next());
      if (entry != null)
        enabledEntries.add(entry);
    }
    return new Index(index.getComparator(), enabledEntries);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.