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
@NodeEntity | |
public class Person { | |
// neo4j節點編號 | |
@GraphId | |
private Long id; | |
// 以下皆定義節點的屬性 | |
private String name; |
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
// 以下是根據不同的人建立不同的Node | |
Person otaku = new Person("宅男", "男", "喜歡宅在家裡面,不喜歡出門"); | |
Person dreamGirl = new Person("正妹", "女", "喜歡戶外運動,熱衷打扮"); | |
Person hunk = new Person("帥哥", "男", "喜歡社交,對於出門穿搭非常講究"); |
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
@RelationshipEntity(type = "CRUSH_ON") | |
public class Crush_On { | |
@GraphId | |
private Long relationshipId; | |
// 起始節點 | |
@StartNode | |
Person personA; | |
// 終止節點 |
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
// 建立關係,將 otaku 指向 dreamGirl | |
otaku.addCrushOnRelationship(otaku,dreamGirl); |
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
// 將每個相同 Relationship 集中存入到 ArrayList 中,因為一個 Node 可能會有多個關係 | |
@Relationship(type="CRUSH_ON") | |
ArrayList<Crush_On> crush_Ons = new ArrayList<Crush_On>(); | |
@Relationship(type="HATE") | |
ArrayList<Hate> hates = new ArrayList<Hate>(); | |
@Relationship(type="LIKE") | |
ArrayList<Like> likes = new ArrayList<Like>(); |
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
public interface PersonRepository extends GraphRepository<Person>{} |
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
public interface GraphRepository<T> extends Neo4jRepository<T, Long> { | |
<S extends T> S save(S s, int depth); | |
<S extends T> Iterable<S> save(Iterable<S> entities, int depth); | |
T findOne(Long id, int depth); | |
Iterable<T> findAll(); |
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
personRepository.save(otaku); |
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
func checkerBoard(){ //產生出遊戲題目 | |
//亂數 | |
let shuffledDistribution = GKShuffledDistribution(lowestValue: 0, highestValue: imageName.count - 1) | |
var count = 0; | |
for i in 0...5{ | |
let index1 = shuffledDistribution.nextInt() | |
let index2 = shuffledDistribution.nextInt() | |
let index3 = shuffledDistribution.nextInt() | |
let index4 = shuffledDistribution.nextInt() | |
AllCard[count].setBackgroundImage(UIImage(named: imageName[index1]), for: .normal) |
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
// 控制連擊動畫 | |
func AnimateAlpha(comboNumber : Int) { | |
self.combo.alpha = 1 | |
if comboNumber > 0{ | |
combo.text = String(comboNumber)+" COMBO" | |
} | |
UIView.animate(withDuration: 0.7, delay: 0, animations: { | |
self.combo.alpha -= 1 | |
self.combo.transform = CGAffineTransform.identity | |
.translatedBy(x: -100, y: 0) |
OlderNewer