Restore after deleting tense

This commit is contained in:
Abel Fokkinga 2012-11-11 16:04:11 +01:00
parent af0959ff7b
commit 04dd58a040
9 changed files with 112 additions and 90 deletions

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>

View File

@ -0,0 +1,21 @@
//
// ConjugatedTense.h
// Espagram
//
// Created by Abel Fokkinga on 8/29/12.
// Copyright (c) 2012 Abel Fokkinga. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class Conjugations, Tenses, Verbs;
@interface ConjugatedTense : NSManagedObject
@property (nonatomic, retain) NSNumber * regularConjugation;
@property (nonatomic, retain) Verbs *verb;
@property (nonatomic, retain) Tenses *tense;
@property (nonatomic, retain) Conjugations *irregularConjugation;
@end

View File

@ -0,0 +1,22 @@
//
// ConjugatedTense.m
// Espagram
//
// Created by Abel Fokkinga on 8/29/12.
// Copyright (c) 2012 Abel Fokkinga. All rights reserved.
//
#import "ConjugatedTense.h"
#import "Conjugations.h"
#import "Tenses.h"
#import "Verbs.h"
@implementation ConjugatedTense
@dynamic regularConjugation;
@dynamic verb;
@dynamic tense;
@dynamic irregularConjugation;
@end

View File

@ -0,0 +1,13 @@
//
// ConjugatedVerbTableView.h
// Espagram
//
// Created by Abel Fokkinga on 11/8/12.
// Copyright (c) 2012 Abel Fokkinga. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ConjugatedVerbTableView : UITableView
@end

View File

@ -0,0 +1,31 @@
//
// ConjugatedVerbTableView.m
// Espagram
//
// Created by Abel Fokkinga on 11/8/12.
// Copyright (c) 2012 Abel Fokkinga. All rights reserved.
//
#import "ConjugatedVerbTableView.h"
@implementation ConjugatedVerbTableView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end

View File

@ -0,0 +1,20 @@
//
// Conjugations.h
// Espagram
//
// Created by Abel Fokkinga on 8/29/12.
// Copyright (c) 2012 Abel Fokkinga. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class Persons;
@interface Conjugations : NSManagedObject
@property (nonatomic, retain) NSString * root;
@property (nonatomic, retain) NSString * exit;
@property (nonatomic, retain) Persons *conjugationPerson;
@end

View File

@ -1,17 +0,0 @@
//
// Tense.h
// Espagram
//
// Created by Abel Fokkinga on 11/8/12.
// Copyright (c) 2012 Abel Fokkinga. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Tense : NSObject
@property (nonatomic, strong) NSString * tense;
- (NSString *) getTenseInLanguage:(NSString *)language;
@end

View File

@ -1,73 +0,0 @@
//
// Tense.m
// Espagram
//
// Created by Abel Fokkinga on 11/8/12.
// Copyright (c) 2012 Abel Fokkinga. All rights reserved.
//
#import "Tense.h"
@interface Tense()
@property (nonatomic, strong) NSDictionary * text;
@end
@implementation Tense
@synthesize tense = _tense;
@synthesize text = _text;
- (void) tense:(NSString *)t {
if ( ![t isEqualToString:_tense]){
_tense = t;
// reset dictionary
NSLog(@"Resetting tense");
self.text = nil;
}
}
- (NSDictionary *) text {
if ( !_text) {
if ( [self.tense isEqualToString:@"SIMPLE_PRESENT"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Presente",@"Simple present",@"Onvoltooid tegenwoordige tijd",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
if ( [self.tense isEqualToString:@"SIMPLE_PAST"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Indefinido",@"Simple past",@"Verleden tijd",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
if ( [self.tense isEqualToString:@"IMPERFECT"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Imperfecto",@"Imperfect",@"Onvoltooid verleden tijd",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
if ( [self.tense isEqualToString:@"FUTURE"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Futuro",@"Future",@"Toekomstige tijd",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
if ( [self.tense isEqualToString:@"PRESENT_PERFECT"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Perfecto",@"Present perfect",@"Pretérito perfecto",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
if ( [self.tense isEqualToString:@"PAST_PERFECT"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Pluscuamperfecto",@"Past perfect",@"Pretérito pluscuamperfecto",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
if ( [self.tense isEqualToString:@"FUTURE_PERFECT"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Futuro perfecto",@"Future perfect",@"Pretérito pluscuamperfecto",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
if ( [self.tense isEqualToString:@"CONDITIONAL"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Condicional",@"Conditional",@"Voorwaardelijke wijs",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
if ( [self.tense isEqualToString:@"GERUND"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Gerundio",@"Gerund",@"Tegenwoordig deelwoord",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
if ( [self.tense isEqualToString:@"IMPERATIVE"])
_text = [[NSDictionary alloc] initWithObjects:[[NSArray alloc]
initWithObjects:@"Imperativo",@"Imperative",@"Gebiedende wijs",nil] forKeys:[[NSArray alloc] initWithObjects:@"Spanish",@"English",@"Dutch", nil]];
}
return _text;
}
- (NSString *) getTenseInLanguage:(NSString *)language {
return [self.text objectForKey:language];
}
@end