Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed foreach grammar to allow for several statements per foreach
- Loading branch information
1 parent
c4974ae
commit bf6571d
Showing
7 changed files
with
186 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Copyright (c) 2002-2011 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.neo4j.cypherdsl; | ||
|
||
import org.neo4j.cypherdsl.query.AbstractPath; | ||
import org.neo4j.cypherdsl.query.Expression; | ||
import org.neo4j.cypherdsl.query.ForEachStatement; | ||
import org.neo4j.cypherdsl.query.SetProperty; | ||
|
||
/** | ||
* TODO | ||
*/ | ||
public interface ForEachStatements | ||
{ | ||
ForEachStatement create(AbstractPath<?>... paths); | ||
ForEachStatement set( SetProperty... propertyValues ); | ||
ForEachStatement delete( Expression... expressions ); | ||
ForEachStatement relate( AbstractPath<?>... expressions ); | ||
ForEachStatement forEach( ForEachStatement statement ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
src/main/java/org/neo4j/cypherdsl/query/ForEachStatement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* Copyright (c) 2002-2011 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.neo4j.cypherdsl.query; | ||
|
||
import java.util.Arrays; | ||
import org.neo4j.cypherdsl.ForEachStatements; | ||
|
||
/** | ||
* TODO | ||
*/ | ||
public class ForEachStatement | ||
implements ForEachStatements, AsString | ||
{ | ||
private ForEachClause forEachClause; | ||
|
||
public ForEachStatement( ForEachClause forEachClause ) | ||
{ | ||
this.forEachClause = forEachClause; | ||
} | ||
|
||
public ForEachStatement create(AbstractPath<?>... paths) | ||
{ | ||
return new ForEachStatement( forEachClause.add(new CreateClause( Arrays.asList( paths ) ))); | ||
} | ||
|
||
@Override | ||
public ForEachStatement set( SetProperty... setProperties ) | ||
{ | ||
return new ForEachStatement( forEachClause.add(new SetClause( Arrays.asList( setProperties ) ))); | ||
} | ||
|
||
@Override | ||
public ForEachStatement delete( Expression... expressions ) | ||
{ | ||
return new ForEachStatement( forEachClause.add(new DeleteClause( Arrays.asList( expressions ) ))); | ||
} | ||
|
||
@Override | ||
public ForEachStatement relate( AbstractPath<?>... expressions ) | ||
{ | ||
return new ForEachStatement( forEachClause.add(new RelateClause( Arrays.asList( expressions ) ))); | ||
} | ||
|
||
@Override | ||
public ForEachStatement forEach( ForEachStatement statement ) | ||
{ | ||
return new ForEachStatement( forEachClause.add(statement.getClause())); | ||
} | ||
|
||
@Override | ||
public void asString( StringBuilder builder ) | ||
{ | ||
forEachClause.asString( builder ); | ||
} | ||
|
||
public Clause getClause() | ||
{ | ||
return forEachClause; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters