text:
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Memorize_IntentionAction = /** @class */ (function (_super) {
    __extends(Memorize_IntentionAction, _super);
    function Memorize_IntentionAction() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Memorize_IntentionAction.prototype.canHandle = function (intention, ai) {
        if (intention.functor.is_a(ai.o.getSort("action.memorize")))
            return true;
        return false;
    };
    Memorize_IntentionAction.prototype.execute = function (ir, ai) {
        this.ir = ir;
        var intention = ir.action;
        var requester = ir.requester;
        // execute the memorize action:
        console.log(ai.selfID + " memorize: " + intention.attributes[2]);
        // we add the sentence with positive sign, to see if it introduces a contradiction
        var s_l = Term.termToSentences((intention.attributes[2]).term, ai.o);
        console.log("term to sentences (#sentences = " + s_l.length + "): " + s_l);
        var variablesPresent = false;
        var timeModifierPresent = false;
        // 1) see if it has variables AND is more than one sentence:
        for (var _i = 0, s_l_1 = s_l; _i < s_l_1.length; _i++) {
            var s = s_l_1[_i];
            if (s.getAllVariables().length > 0)
                variablesPresent = true;
            for (var _a = 0, _b = s.terms; _a < _b.length; _a++) {
                var t = _b[_a];
                if (t.functor.is_a(ai.o.getSort("time.past")))
                    timeModifierPresent = true;
                if (t.functor.is_a(ai.o.getSort("time.future")))
                    timeModifierPresent = true;
            }
        }
        if (timeModifierPresent) {
            console.warn("time modifiers present, not memorizing for now...");
            var tmp = "action.talk('" + ai.selfID + "'[#id], perf.ack.unsure(" + requester + "))";
            var term = Term.fromString(tmp, ai.o);
            ai.intentions.push(new IntentionRecord(term, null, null, null, ai.timeStamp));
            ir.succeeded = true;
            return true;
        }
        // check for the special case where the player is stating that they "know/remember" something, so we follow up
        // asking about it:
        if (variablesPresent && s_l[0].terms.length == 1 && s_l[0].sign[0]) {
            var term = s_l[0].terms[0];
            if (term.functor.is_a(ai.o.getSort("verb.know")) &&
                term.attributes.length == 2 &&
                term.attributes[0] instanceof ConstantTermAttribute &&
                term.attributes[1] instanceof TermTermAttribute &&
                requester instanceof ConstantTermAttribute) {
                var term2 = term.attributes[1].term;
                if (term.attributes[0].value == requester.value &&
                    term2.functor.is_a(ai.o.getSort("property-with-value")) &&
                    term2.attributes.length == 2 &&
                    term2.attributes[0] instanceof ConstantTermAttribute &&
                    term2.attributes[1] instanceof VariableTermAttribute) {
                    // ask the requester about it, no need to memorize this yet:
                    var queryTerm = new Term(ai.o.getSort("perf.q.query"), [requester, term2.attributes[1], term.attributes[1]]);
                    var actionTerm = Term.fromString("action.talk('" + ai.selfID + "'[#id], " + queryTerm + ")", ai.o);
                    ai.intentions.push(new IntentionRecord(actionTerm, null, null, null, ai.timeStamp));
                    ir.succeeded = true;
                    return true;
                }
            }
        }
        if (s_l.length > 1 && variablesPresent) {
            // Note: I added this case earlier in the development of the game, but I cannot figure out what case was it covering,
            // so, I removed it as I cannot find any sentence for which this is needed.
            // this is the complicated case, we can just launch an inference process to see if we need to memorize or we already knew
            // console.log("executeIntention memorize: sentence of length > 1 with variables, this is a complex case, we need to try to negate the sentences: " + s_l);
            // let negated_s_l:Sentence[] = [];
            // let negated_s:Sentence = new Sentence([],[]);
            // for(let s of s_l) {
            // 	if (s.getAllVariables().length > 0) variablesPresent = true;
            // 	for(let t of s.terms) {
            // 		if (t.functor.is_a(ai.o.getSort("time.past"))) timeModifierPresent = true;
            // 		if (t.functor.is_a(ai.o.getSort("time.future"))) timeModifierPresent = true;
            // 	}
            // 	let tmp:Sentence[] = s.negate();
            // 	if (tmp == null || tmp.length != 1) {
            // 		console.error("executeIntention memorize: cannot negate sentences in intention!: " + intention);
            // 		let tmp:string = "action.talk('"+ai.selfID+"'[#id], perf.ack.unsure("+requester+"))";
            // 		let term:Term = Term.fromString(tmp, ai.o);
            // 		ai.intentions.push(new IntentionRecord(term, null, null, null, ai.timeStamp));
            // 		return true;
            // 	}
            // 	negated_s.terms = negated_s.terms.concat(tmp[0].terms);
            // 	negated_s.sign = negated_s.sign.concat(tmp[0].sign);
            // }
            // negated_s_l = [negated_s];
            // ai.queuedInferenceProcesses.push(new InferenceRecord(ai, [], [negated_s_l], 1, 0, false, null, new Memorize_InferenceEffect(intention, true)));
            // Alternative code with better negation:
            // let targets:Sentence[][] = [];
            // let negatedExpression:Term = new Term(ai.o.getSort("#not"),
            // 								 	  [new TermTermAttribute((<TermTermAttribute>(intention.attributes[2])).term)])
            // console.log("Memorize, negatedExpression: " + negatedExpression);
            // let target:Sentence[] = Term.termToSentences(negatedExpression, ai.o);
            // targets.push(target)
            // ai.queuedInferenceProcesses.push(new InferenceRecord(ai, [], targets, 1, 0, false, null, new Memorize_InferenceEffect(intention, true)));
            ai.queuedInferenceProcesses.push(new InferenceRecord(ai, [], [s_l], 1, 0, false, null, new Memorize_InferenceEffect(intention, false)));
        }
        else {
            if (s_l.length == 1 && s_l[0].terms.length == 1) {
                // Check for the special case, where the player is just correcting a wrong statement she stated in the past:
                var negatedToMemorize = new Sentence(s_l[0].terms, [!s_l[0].sign[0]]);
                var se = ai.longTermMemory.findSentenceEntry(negatedToMemorize);
                if (se != null && se.provenance == MEMORIZE_PROVENANCE) {
                    console.log("Correcting a wrong statement she stated in the past! checking if this would cause a contradiction");
                    // We can safely remove the "negatedToMemorize" sentence, since, if the new one causes a contradiction, it means it was already
                    // implied by the KB, so it wasn't needed. But if it does not, then we had to remove it anyway:
                    ai.longTermMemory.removeSentence(negatedToMemorize);
                }
            }
            console.log("executeIntention memorize: sentence list of length 1, easy case: " + s_l);
            ai.queuedInferenceProcesses.push(new InferenceRecord(ai, [], [s_l], 1, 0, false, null, new Memorize_InferenceEffect(intention, false)));
        }
        ir.succeeded = true;
        return true;
    };
    Memorize_IntentionAction.prototype.saveToXML = function (ai) {
        return "<IntentionAction type=\"Memorize_IntentionAction\"/>";
    };
    Memorize_IntentionAction.loadFromXML = function (xml, ai) {
        return new Memorize_IntentionAction();
    };
    return Memorize_IntentionAction;
}(IntentionAction));


text:
package eu.inn.binders.naming

class LowercaseConverter extends Converter {
  def convert(identifier: String): String = identifier.toLowerCase
}

redpajama_set_name: RedPajamaGithub


text:
package neo4j.relations;

import neo4j.models.AbstractModel;
import neo4j.models.orga.Person;
import neo4j.models.orga.Skill;
import neo4j.models.orga.SkillRating;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.neo4j.annotation.*;

import java.util.Date;

@RelationshipEntity(type = Relations.PERSON_SKILLS)
@TypeAlias(value = "SkillRelation")
public class SkillRelation extends AbstractModel {

  @StartNode
  @Fetch
  public Person person;

  @EndNode
  @Fetch
  public Skill skill;

  public SkillRating rating;

  @GraphProperty(propertyType = Long.class)
  public Date since;

}


text:
PlaceholderJ is a simple Android library created to help you to handle screens with empty lists, no items found, loading and errors.

## Screenshots
-----------

![Demo screenshot](https://github.com/jackmiras/placeholderj/blob/master/art/sample.gif)

## Observations
Before you start, keep in mind that PlaceholderJ views were projected only to handle with errors
generated by Retrofit. So, If need your error/empty views to handle errors from other sources, you're encouraged to
implement it yourself and send me a pull request! ;)

### Include this library:

``` groovy
allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
```

``` groovy
dependencies {
    compile 'com.github.jackmiras:placeholderj:2.3.0'
}
```
### Quick Start
-----------
#### Step 1 -  You will need some views for PlaceHolderJ in your layout.
``` xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include layout="@layout/item_toolbar" />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerview_cupon"
        android:scrollbars="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="?attr/actionBarSize"
        android:padding="8dp" />

    <include layout="@layout/view_empty" />

    <include layout="@layout/view_loading" />

    <include layout="@layout/view_error" />

</FrameLayout>
```
As you see, you can include a loading, empty and error views, but it's better to include only the views you'll be using.

#### Step 2 - You will need create a instance of PlaceHolderJ in your Activity or Fragment.
##### Activity
``` java
public class MainActivity extends AppCompatActivity {

    private PlaceHolderJ placeHolderJ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        placeHolderJ = new PlaceHolderJ(this, R.id.recyclerview_cupon);
        placeHolderJ.init(R.id.view_loading, R.id.view_empty, R.id.view_error);
    }
}
```
##### Fragment
``` java
public class MainFragment extends Fragment {

    private PlaceHolderJ placeHolderJ;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        container = (ViewGroup) inflater.inflate(R.layout.fragment_main, null);

        placeHolderJ = new PlaceHolderJ(container, R.id.recyclerview_cupon);
        placeHolderJ.init(R.id.view_loading, R.id.view_empty, R.id.view_error);

        return container;
    }
}
```
Note that PlaceHolderJ() constructor takes two parameters, the Activity/ViewGroup that contains the views that will be managed by PlaceHolderJ, and the view that will contain the placeholders.
You have to call the init method of your PlaceHolderJ instance and it takes up to three parameters, corresponding to the ids of the placeholder views for "loading", "error" and "empty", but you only have to include which ones that you need.

#### Step 3 - If you need to customize something in the PlaceHolderJ views, you can use PlaceHolderManager for that.
You should keep a singleton of the PlaceHolderManager in your application. The usage of PlaceHolderManager is exemplified below:

##### Application
``` java
public class SampleApplication extends Application {

    private static PlaceHolderManager placeHolderManager;

    @Override
    public void onCreate() {
        super.onCreate();

        placeHolderManager = new PlaceHolderManager.Configurator()
                .loadingBackground(android.R.color.holo_green_light)
                .errorText(R.string.global_custom_error, 0, 0)
                .config();
    }

    public static PlaceHolderManager getPlaceHolderManager() {
        return placeHolderManager;
    }
}
```
##### Don't forget to add the Application class into your AndroidManifest.xml
``` xml
<application
        android:name=".SampleApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/SampleTheme" >
```
And after that you only need to pass your PlaceHolderManager instance to the constructor of PlaceHolderJ in your Activity or Fragment. The implementation looks like the code below:

``` java
public class MainActivity extends AppCompatActivity {

    private PlaceHolderJ placeHolderJ;
    private PlaceHolderManager placeHolderManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        placeHolderManager  = SampleApplication.getPlaceHolderManager();
        placeHolderJ = new PlaceHolderJ(this, R.id.recyclerview_cupon, placeHolderManager);
        placeHolderJ.init(R.id.view_loading, R.id.view_empty, R.id.view_error);
    }
}
```
If you want to check a sample app to get a more realistic idea of how use PlaceHolderJ click [here](https://github.com/jackmiras/placeholderj/tree/master/app/src/main).

If you want to download the sample app click [here](https://drive.google.com/file/d/0B0Tf80UFMc0WZTFIb1dUbGdSLUk/view?usp=sharing).

## Pull Requests

I welcome and encourage all pull requests. It usually takes me around 48 hours to respond to any issue or request. Here are some basic rules to follow to ensure the fastest reviewing and addition of your request:
  1. Match coding style (braces, spacing, etc.) This is best achieved using CRTL+ALT+L (Reformat code) on Linux and CMD+Option+L on Mac (not sure for Windows) with Android Studio defaults.
  2. If it's a feature, bugfix, or anything else, please only change code where strictly necessary.
   **DO NOT** do this: Ex: Title "Fixes Crash Related to Bug" but includes other files that were changed without explanation or that weren't related to the bug you fixed. Another example is a non-descriptive title "Fixes Stuff".
  3. Pull requests must be made against ```develop``` branch.
  4. Have fun!

## Maintainers

[Jack Miras](https://github.com/jackmiras) ([@jackmiras](https://www.twitter.com/@jackmiras))

### Contributors

[Daivid Silverio](https://github.com/daividssilverio) ([@daividssilverio](https://www.twitter.com/@daividssilverio))

[Analira Scalabrini](https://github.com/analiras2) ([@analiras2](https://www.twitter.com/@analiras2))