當前位置: 首頁>>代碼示例>>Java>>正文


Java Tuple2類代碼示例

本文整理匯總了Java中org.parboiled.common.Tuple2的典型用法代碼示例。如果您正苦於以下問題:Java Tuple2類的具體用法?Java Tuple2怎麽用?Java Tuple2使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Tuple2類屬於org.parboiled.common包,在下文中一共展示了Tuple2類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: assertForeignKeys

import org.parboiled.common.Tuple2; //導入依賴的package包/類
public static void assertForeignKeys(GraphDatabaseService neo4j, Neo4jVersionerCore neo4jVersionerCore, Map<Tuple2<String, String>, Map<String, String>> relationships) {

		ResourceIterator<Optional<Node>> tablesStateList = neo4j.findNodes(Label.label("Table")).map(table -> neo4jVersionerCore.findStateNode(table.getId()));

		List<Relationship> foreignKeysList = tablesStateList.stream()
				.map(tableStateOpt -> tableStateOpt.get().getRelationships(Direction.OUTGOING, RelationshipType.withName("RELATION")))
				.flatMap(list -> StreamSupport.stream(list.spliterator(), false))
				.collect(toList());

		assertThat(foreignKeysList)
				.hasSize(relationships.size());

		relationships.forEach((keys, description) -> assertThat(foreignKeysList).anySatisfy(foreignKey -> {
			assertThat(foreignKey.getStartNode().hasProperty(keys.a)).isTrue();
			assertThat(foreignKey.getEndNode().hasProperty(keys.b)).isTrue();
			assertThat(foreignKey.getAllProperties()).containsAllEntriesOf(description);
		}));
	}
 
開發者ID:h-omer,項目名稱:neo4j-versioner-sql,代碼行數:19,代碼來源:TestData.java

示例2: shouldInitCorrectlyTheGraph

import org.parboiled.common.Tuple2; //導入依賴的package包/類
@Test
public void shouldInitCorrectlyTheGraph() throws SQLException {

	initMocks(mockedDatabaseImporter,
			FULLDATABASE.DATABASE(),
			FULLDATABASE.SCHEMAS(),
			FULLDATABASE.TABLES(),
			FULLDATABASE.TABLES_COLUMNS(),
			FULLDATABASE.FOREIGN_KEYS());

	neo4j.getGraphDatabaseService().execute("CALL sql.versioner.init('" + MOCKED_DATABASE_NAME + "', '', 0, '', '', '')");


	//Test database
	assertDatabaseNode(neo4j.getGraphDatabaseService(), neo4jVersionerCore,
			newHashMap("databaseType", MOCKED_DATABASE_NAME, "name", "testDatabase"), 1);


	//Test schema
	assertSchemaNode(neo4j.getGraphDatabaseService(), neo4jVersionerCore,
			newHashMap("name", "testSchema"), 2);

	//Test table
	assertTables(neo4j.getGraphDatabaseService(), neo4jVersionerCore,
			newHashMap("testTable1", newHashMap("testTable1Column1", new String[]{"PRIMARY KEY", "NOT NULL"}),
					"testTable2", newHashMap("testTable2Column1", new String[]{"PRIMARY KEY", "NOT NULL"},
							"testTable2Column2", new String[]{"NOT NULL"})));

	//Test foreign keys
	assertForeignKeys(neo4j.getGraphDatabaseService(), neo4jVersionerCore,
			newHashMap(
					new Tuple2<>("testTable2Column2", "testTable1Column1"), newHashMap("constraint", "testConstraintName", "source_column", "testTable2Column2", "destination_column", "testTable1Column1")
					));
}
 
開發者ID:h-omer,項目名稱:neo4j-versioner-sql,代碼行數:35,代碼來源:InitIntegrationTest.java

示例3: Definition

import org.parboiled.common.Tuple2; //導入依賴的package包/類
public Rule Definition() {
    return Sequence(
            push(new Tuple2(false, true)),Identifier(),
            LEFTARROW(),
            Expression(), push(new DefinitionNode((ExpressionNode) pop(), (IdentifierNode) pop()))
    );
}
 
開發者ID:simonwibberley,項目名稱:GramExp,代碼行數:8,代碼來源:PegParser.java

示例4: Primary

import org.parboiled.common.Tuple2; //導入依賴的package包/類
public Rule Primary() {
    return Sequence(FirstOf(
            Sequence(push(new Tuple2(false,false)), Identifier(), TestNot(LEFTARROW())),
            Sequence(OPEN(), Expression(), CLOSE()),
            Literal(),
            Class(),
            DOT(),
            EMPTY(),
            NOTHING(),
            EndOfFile()
            ), push(new PrimaryNode((SuperNode)pop())));
}
 
開發者ID:simonwibberley,項目名稱:GramExp,代碼行數:13,代碼來源:PegParser.java

示例5: Identifier

import org.parboiled.common.Tuple2; //導入依賴的package包/類
@SuppressSubnodes
public Rule Identifier() {
    Var<StringBuilder> id = new Var<>(new StringBuilder());
    Var<ArgumentsNode> optional = new Var<>();

    return Sequence(
            IdentStart(), (id.get().append(match())!=null),
            ZeroOrMore(IdentCont(), (id.get().append(match())!=null)),
            Optional(Arguments(), optional.set((ArgumentsNode)pop())),
            push(new IdentifierNode(id.get().toString(), optional.get(), (Tuple2)pop())),
            Spacing()
    );
}
 
開發者ID:simonwibberley,項目名稱:GramExp,代碼行數:14,代碼來源:PegParser.java

示例6: Arguments

import org.parboiled.common.Tuple2; //導入依賴的package包/類
public Rule Arguments() {
    Var<List<SuperNode>> args = new Var<>(new ArrayList<>());
    return Sequence(
            AOPEN(),
            OneOrMore(FirstOf(Sequence(push(new Tuple2(true, ((Tuple2)peek()).b)),Identifier()), Literal()), args.get().add((SuperNode)pop())),
            ACLOSE(),
            push(new ArgumentsNode<>(args.get()))
    );
}
 
開發者ID:simonwibberley,項目名稱:GramExp,代碼行數:10,代碼來源:PegParser.java

示例7: lines

import org.parboiled.common.Tuple2; //導入依賴的package包/類
/**
 * A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}.
 * Enables printing of rule tracing log messages for all input in the given range of input lines.
 *
 * @param firstLine the number of the first input line to generate tracing message for
 * @param lastLine  the number of the last input line to generate tracing message for
 * @return a predicate
 */
public static Predicate<Tuple2<Context<?>, Boolean>> lines(final int firstLine, final int lastLine) {
    return new Predicate<Tuple2<Context<?>, Boolean>>() {
        public boolean apply(Tuple2<Context<?>, Boolean> tuple) {
            int line = tuple.a.getInputBuffer().getPosition(tuple.a.getCurrentIndex()).line;
            return firstLine <= line && line <= lastLine;
        }
    };
}
 
開發者ID:parboiled1,項目名稱:parboiled,代碼行數:17,代碼來源:Filters.java

示例8: fromLine

import org.parboiled.common.Tuple2; //導入依賴的package包/類
/**
 * A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}.
 * Enables printing of rule tracing log messages for all input in the given range of input lines.
 *
 * @param firstLine the number of the first input line to generate tracing message for
 * @return a predicate
 */
public static Predicate<Tuple2<Context<?>, Boolean>> fromLine(final int firstLine) {
    return new Predicate<Tuple2<Context<?>, Boolean>>() {
        public boolean apply(Tuple2<Context<?>, Boolean> tuple) {
            return tuple.a.getInputBuffer().getPosition(tuple.a.getCurrentIndex()).line >= firstLine;
        }
    };
}
 
開發者ID:parboiled1,項目名稱:parboiled,代碼行數:15,代碼來源:Filters.java

示例9: untilLine

import org.parboiled.common.Tuple2; //導入依賴的package包/類
/**
 * A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}.
 * Enables printing of rule tracing log messages for all input in the given range of input lines.
 *
 * @param lastLine  the number of the last input line to generate tracing message for
 * @return a predicate
 */
public static Predicate<Tuple2<Context<?>, Boolean>> untilLine(final int lastLine) {
    return new Predicate<Tuple2<Context<?>, Boolean>>() {
        public boolean apply(Tuple2<Context<?>, Boolean> tuple) {
            return tuple.a.getInputBuffer().getPosition(tuple.a.getCurrentIndex()).line <= lastLine;
        }
    };
}
 
開發者ID:parboiled1,項目名稱:parboiled,代碼行數:15,代碼來源:Filters.java

示例10: onlyRules

import org.parboiled.common.Tuple2; //導入依賴的package包/類
/**
 * A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}.
 * Enables printing of rule tracing log messages for all given rules (without their sub rules).
 *
 * @param rules the rules to generate tracing message for
 * @return a predicate
 */
public static Predicate<Tuple2<Context<?>, Boolean>> onlyRules(final Rule... rules) {
    return new Predicate<Tuple2<Context<?>, Boolean>>() {
        public boolean apply(Tuple2<Context<?>, Boolean> tuple) {
            for (Rule rule : rules) if (tuple.a.getMatcher() == rule) return true;
            return false;
        }
    };
}
 
開發者ID:parboiled1,項目名稱:parboiled,代碼行數:16,代碼來源:Filters.java

示例11: rulesBelow

import org.parboiled.common.Tuple2; //導入依賴的package包/類
/**
 * A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}.
 * Enables printing of rule tracing log messages for all sub rules of the given rules.
 *
 * @param rules the rules whose sub rules to generate tracing message for
 * @return a predicate
 */
public static Predicate<Tuple2<Context<?>, Boolean>> rulesBelow(final Rule... rules) {
    return new Predicate<Tuple2<Context<?>, Boolean>>() {
        public boolean apply(Tuple2<Context<?>, Boolean> tuple) {
            MatcherPath path = tuple.a.getPath();
            for (Rule rule : rules) {
                Matcher matcher = (Matcher) rule;
                if (tuple.a.getMatcher() != matcher && path.contains(matcher)) return true;
            }
            return false;
        }
    };
}
 
開發者ID:parboiled1,項目名稱:parboiled,代碼行數:20,代碼來源:Filters.java

示例12: onlyMatches

import org.parboiled.common.Tuple2; //導入依賴的package包/類
/**
 * A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}.
 * Enables printing of rule tracing log messages for all matched rules.
 *
 * @return a predicate
 */
public static Predicate<Tuple2<Context<?>, Boolean>> onlyMatches() {
    return new Predicate<Tuple2<Context<?>, Boolean>>() {
        public boolean apply(Tuple2<Context<?>, Boolean> tuple) {
            return tuple.b;
        }
    };
}
 
開發者ID:parboiled1,項目名稱:parboiled,代碼行數:14,代碼來源:Filters.java

示例13: onlyMismatches

import org.parboiled.common.Tuple2; //導入依賴的package包/類
/**
 * A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}.
 * Enables printing of rule tracing log messages for all mismatched rules.
 *
 * @return a predicate
 */
public static Predicate<Tuple2<Context<?>, Boolean>> onlyMismatches() {
    return new Predicate<Tuple2<Context<?>, Boolean>>() {
        public boolean apply(Tuple2<Context<?>, Boolean> tuple) {
            return !tuple.b;
        }
    };
}
 
開發者ID:parboiled1,項目名稱:parboiled,代碼行數:14,代碼來源:Filters.java

示例14: shouldReloadCorrectlyTheGraphWithANewTable

import org.parboiled.common.Tuple2; //導入依賴的package包/類
@Test
public void shouldReloadCorrectlyTheGraphWithANewTable() throws SQLException {

	initMocks(mockedDatabaseImporter,
			FULLDATABASE.DATABASE(),
			FULLDATABASE.SCHEMAS(),
			FULLDATABASE.TABLES(),
			FULLDATABASE.TABLES_COLUMNS(),
			FULLDATABASE.FOREIGN_KEYS());

	neo4j.getGraphDatabaseService().execute("CALL sql.versioner.init('" + MOCKED_DATABASE_NAME + "', '', 0, '', '', '')");

	List<Table> newTables = FULLDATABASE.TABLES();
	newTables.add(Table.builder()
			.name("testTable3")
			.foreignKeys(newArrayList())
			.columns(newArrayList())
			.build());

	Map<String, List<TableColumn>> newTableColumns = FULLDATABASE.TABLES_COLUMNS();
	newTableColumns.put("testTable3", newArrayList(TableColumn.builder()
			.name("testTable3Column1")
			.attributes(newArrayList("NOT NULL"))
			.build()));
	//TODO add relationship to table1

	initMocks(mockedDatabaseImporter,
			FULLDATABASE.DATABASE(),
			FULLDATABASE.SCHEMAS(),
			newTables,
			newTableColumns,
			FULLDATABASE.FOREIGN_KEYS());

	neo4j.getGraphDatabaseService().execute("CALL sql.versioner.reload('', 0, '', '')");


	//Test database
	assertDatabaseNode(neo4j.getGraphDatabaseService(), neo4jVersionerCore,
			newHashMap("databaseType", MOCKED_DATABASE_NAME, "name", "testDatabase"), 1);


	//Test schema
	assertSchemaNode(neo4j.getGraphDatabaseService(), neo4jVersionerCore,
			newHashMap("name", "testSchema"), 3);

	//Test table
	assertTables(neo4j.getGraphDatabaseService(), neo4jVersionerCore,
			newHashMap("testTable1", newHashMap("testTable1Column1", new String[]{"PRIMARY KEY", "NOT NULL"}),
					"testTable2", newHashMap("testTable2Column1", new String[]{"PRIMARY KEY", "NOT NULL"},
							"testTable2Column2", new String[]{"NOT NULL"}),
					"testTable3", newHashMap("testTable3Column1", new String[]{"NOT NULL"})));

	//Test foreign keys
	assertForeignKeys(neo4j.getGraphDatabaseService(), neo4jVersionerCore,
			newHashMap(
					new Tuple2<>("testTable2Column2", "testTable1Column1"), newHashMap("constraint", "testConstraintName", "source_column", "testTable2Column2", "destination_column", "testTable1Column1")
			));
}
 
開發者ID:h-omer,項目名稱:neo4j-versioner-sql,代碼行數:59,代碼來源:ReloadIntegrationTest.java

示例15: IdentifierNode

import org.parboiled.common.Tuple2; //導入依賴的package包/類
public IdentifierNode(String id, ArgumentsNode args, Tuple2<Boolean,Boolean> argdef) {
    super(args);
    this.id = id;
    this.argument = argdef.a;
    this.definition = argdef.b;
}
 
開發者ID:simonwibberley,項目名稱:GramExp,代碼行數:7,代碼來源:IdentifierNode.java


注:本文中的org.parboiled.common.Tuple2類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。