Search in sources :

Example 16 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project intellij-elixir by KronicDeth.

the class Resolvable method resolvable.

@NotNull
private static Resolvable resolvable(@NotNull Parent parent, @NotNull ASTNode[] children) {
    Resolvable resolvable;
    if (children.length == 0) {
        resolvable = new Exact(":\"\"");
    } else {
        List<String> regexList = new LinkedList<>();
        List<Integer> codePointList = null;
        for (ASTNode child : children) {
            IElementType elementType = child.getElementType();
            if (elementType == ElixirTypes.FRAGMENT) {
                codePointList = parent.addFragmentCodePoints(codePointList, child);
            } else if (elementType == ElixirTypes.ESCAPED_CHARACTER) {
                codePointList = parent.addEscapedCharacterCodePoints(codePointList, child);
            } else if (elementType == ElixirTypes.ESCAPED_EOL) {
                codePointList = parent.addEscapedEOL(codePointList, child);
            } else if (elementType == ElixirTypes.HEXADECIMAL_ESCAPE_PREFIX) {
                codePointList = addChildTextCodePoints(codePointList, child);
            } else if (elementType == ElixirTypes.INTERPOLATION) {
                if (codePointList != null) {
                    regexList.add(codePointListToString(codePointList));
                    codePointList = null;
                }
                regexList.add(interpolation());
            } else if (elementType == ElixirTypes.QUOTE_HEXADECIMAL_ESCAPE_SEQUENCE || elementType == ElixirTypes.SIGIL_HEXADECIMAL_ESCAPE_SEQUENCE) {
                codePointList = parent.addHexadecimalEscapeSequenceCodePoints(codePointList, child);
            } else {
                throw new NotImplementedException("Can't convert to Resolvable " + child);
            }
        }
        if (codePointList != null && regexList.isEmpty()) {
            resolvable = resolvableLiteral(codePointList);
        } else {
            if (codePointList != null) {
                regexList.add(codePointListToRegex(codePointList));
            }
            resolvable = new Pattern(join(regexList));
        }
    }
    return resolvable;
}
Also used : IElementType(com.intellij.psi.tree.IElementType) Pattern(org.elixir_lang.reference.resolver.atom.resolvable.Pattern) NotImplementedException(org.apache.commons.lang.NotImplementedException) ASTNode(com.intellij.lang.ASTNode) Exact(org.elixir_lang.reference.resolver.atom.resolvable.Exact) LinkedList(java.util.LinkedList) NotNull(org.jetbrains.annotations.NotNull)

Example 17 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project h2o-2 by h2oai.

the class Tree method getNumLeaves.

public static int getNumLeaves(AutoBuffer ab, int leftSize, boolean regression) {
    int result = 0;
    int startPos = ab.position();
    while (ab.position() < startPos + leftSize) {
        byte currentNodeType = (byte) ab.get1();
        if (currentNodeType == 'S' || currentNodeType == 'E') {
            // skip col and split value.
            ab.get2();
            // skip col and split value.
            ab.get4f();
            int skipSize = ab.get1();
            if (skipSize == 0) {
                ab.get3();
            }
        } else if (currentNodeType == '[') {
            result++;
            if (regression)
                ab.get4f();
            else
                ab.get1();
        } else {
            throw new NotImplementedException();
        }
    }
    // return to the original position so the buffer seems untouched.
    ab.position(startPos);
    return result;
}
Also used : NotImplementedException(org.apache.commons.lang.NotImplementedException)

Example 18 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project hbase by apache.

the class FSTableDescriptors method add.

/**
   * Adds (or updates) the table descriptor to the FileSystem
   * and updates the local cache with it.
   */
@Override
public void add(HTableDescriptor htd) throws IOException {
    if (fsreadonly) {
        throw new NotImplementedException("Cannot add a table descriptor - in read only mode");
    }
    TableName tableName = htd.getTableName();
    if (TableName.META_TABLE_NAME.equals(tableName)) {
        throw new NotImplementedException();
    }
    if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tableName.getNameAsString())) {
        throw new NotImplementedException("Cannot add a table descriptor for a reserved subdirectory name: " + htd.getNameAsString());
    }
    updateTableDescriptor(htd);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) NotImplementedException(org.apache.commons.lang.NotImplementedException)

Example 19 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project hbase by apache.

the class FSTableDescriptors method createTableDescriptorForTableDirectory.

/**
   * Create a new HTableDescriptor in HDFS in the specified table directory. Happens when we create
   * a new table or snapshot a table.
   * @param tableDir table directory under which we should write the file
   * @param htd description of the table to write
   * @param forceCreation if <tt>true</tt>,then even if previous table descriptor is present it will
   *          be overwritten
   * @return <tt>true</tt> if the we successfully created the file, <tt>false</tt> if the file
   *         already exists and we weren't forcing the descriptor creation.
   * @throws IOException if a filesystem error occurs
   */
public boolean createTableDescriptorForTableDirectory(Path tableDir, HTableDescriptor htd, boolean forceCreation) throws IOException {
    if (fsreadonly) {
        throw new NotImplementedException("Cannot create a table descriptor - in read only mode");
    }
    FileStatus status = getTableInfoPath(fs, tableDir);
    if (status != null) {
        LOG.debug("Current tableInfoPath = " + status.getPath());
        if (!forceCreation) {
            if (fs.exists(status.getPath()) && status.getLen() > 0) {
                if (readTableDescriptor(fs, status).equals(htd)) {
                    LOG.debug("TableInfo already exists.. Skipping creation");
                    return false;
                }
            }
        }
    }
    Path p = writeTableDescriptor(fs, htd, tableDir, status);
    return p != null;
}
Also used : Path(org.apache.hadoop.fs.Path) FileStatus(org.apache.hadoop.fs.FileStatus) NotImplementedException(org.apache.commons.lang.NotImplementedException)

Example 20 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project openhab1-addons by openhab.

the class BaseIntegrationTest method initService.

@BeforeClass
public static void initService() throws InterruptedException {
    items.put("dimmer", new DimmerItem("dimmer"));
    items.put("number", new NumberItem("number"));
    items.put("string", new StringItem("string"));
    items.put("switch", new SwitchItem("switch"));
    items.put("contact", new ContactItem("contact"));
    items.put("color", new ColorItem("color"));
    items.put("rollershutter", new RollershutterItem("rollershutter"));
    items.put("datetime", new DateTimeItem("datetime"));
    items.put("call", new CallItem("call"));
    items.put("location", new LocationItem("location"));
    service = new DynamoDBPersistenceService();
    service.setItemRegistry(new ItemRegistry() {

        @Override
        public void removeItemRegistryChangeListener(ItemRegistryChangeListener listener) {
            throw new NotImplementedException();
        }

        @Override
        public boolean isValidItemName(String itemName) {
            throw new NotImplementedException();
        }

        @Override
        public Collection<Item> getItems(String pattern) {
            throw new NotImplementedException();
        }

        @Override
        public Collection<Item> getItems() {
            throw new NotImplementedException();
        }

        @Override
        public Item getItemByPattern(String name) throws ItemNotFoundException, ItemNotUniqueException {
            throw new NotImplementedException();
        }

        @Override
        public Item getItem(String name) throws ItemNotFoundException {
            Item item = items.get(name);
            if (item == null) {
                throw new ItemNotFoundException(name);
            }
            return item;
        }

        @Override
        public void addItemRegistryChangeListener(ItemRegistryChangeListener listener) {
            throw new NotImplementedException();
        }
    });
    HashMap<String, Object> config = new HashMap<>();
    config.put("region", System.getProperty("DYNAMODBTEST_REGION"));
    config.put("accessKey", System.getProperty("DYNAMODBTEST_ACCESS"));
    config.put("secretKey", System.getProperty("DYNAMODBTEST_SECRET"));
    config.put("tablePrefix", "dynamodb-integration-tests-");
    for (Entry<String, Object> entry : config.entrySet()) {
        if (entry.getValue() == null) {
            logger.warn(String.format("Expecting %s to have value for integration tests. Integration tests will be skipped", entry.getKey()));
            service = null;
            return;
        }
    }
    service.activate(null, config);
    // Clear data
    for (String table : new String[] { "dynamodb-integration-tests-bigdecimal", "dynamodb-integration-tests-string" }) {
        try {
            service.getDb().getDynamoClient().deleteTable(table);
            service.getDb().getDynamoDB().getTable(table).waitForDelete();
        } catch (ResourceNotFoundException e) {
        }
    }
}
Also used : LocationItem(org.openhab.core.library.items.LocationItem) HashMap(java.util.HashMap) NotImplementedException(org.apache.commons.lang.NotImplementedException) ColorItem(org.openhab.core.library.items.ColorItem) DateTimeItem(org.openhab.core.library.items.DateTimeItem) ItemRegistry(org.openhab.core.items.ItemRegistry) DimmerItem(org.openhab.core.library.items.DimmerItem) SwitchItem(org.openhab.core.library.items.SwitchItem) RollershutterItem(org.openhab.core.library.items.RollershutterItem) CallItem(org.openhab.library.tel.items.CallItem) Item(org.openhab.core.items.Item) ColorItem(org.openhab.core.library.items.ColorItem) DateTimeItem(org.openhab.core.library.items.DateTimeItem) StringItem(org.openhab.core.library.items.StringItem) ContactItem(org.openhab.core.library.items.ContactItem) NumberItem(org.openhab.core.library.items.NumberItem) LocationItem(org.openhab.core.library.items.LocationItem) DimmerItem(org.openhab.core.library.items.DimmerItem) RollershutterItem(org.openhab.core.library.items.RollershutterItem) ItemRegistryChangeListener(org.openhab.core.items.ItemRegistryChangeListener) ResourceNotFoundException(com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException) SwitchItem(org.openhab.core.library.items.SwitchItem) ContactItem(org.openhab.core.library.items.ContactItem) ItemNotUniqueException(org.openhab.core.items.ItemNotUniqueException) StringItem(org.openhab.core.library.items.StringItem) NumberItem(org.openhab.core.library.items.NumberItem) Collection(java.util.Collection) CallItem(org.openhab.library.tel.items.CallItem) ItemNotFoundException(org.openhab.core.items.ItemNotFoundException) BeforeClass(org.junit.BeforeClass)

Aggregations

NotImplementedException (org.apache.commons.lang.NotImplementedException)36 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Path (org.apache.hadoop.fs.Path)4 ASTNode (com.intellij.lang.ASTNode)3 IElementType (com.intellij.psi.tree.IElementType)3 File (java.io.File)3 Collection (java.util.Collection)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 Entry (java.util.Map.Entry)3 NotNull (org.jetbrains.annotations.NotNull)3 LeafPsiElement (com.intellij.psi.impl.source.tree.LeafPsiElement)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Set (java.util.Set)2 TableName (org.apache.hadoop.hbase.TableName)2 DMLProgram (org.apache.sysml.parser.DMLProgram)2 XSDConstrainingFacet (org.eclipse.xsd.XSDConstrainingFacet)2