package org.apache.rocketmq.connect.jms.connector;

import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;
import org.apache.rocketmq.connect.jms.Config;
import org.apache.rocketmq.connect.jms.ErrorCode;
import org.apache.rocketmq.connect.jms.Replicator;
import org.apache.rocketmq.connect.jms.pattern.PatternProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSON;
import io.openmessaging.KeyValue;
import io.openmessaging.connector.api.data.EntryType;
import io.openmessaging.connector.api.data.SourceDataEntry;
import io.openmessaging.connector.api.exception.DataConnectException;
import io.openmessaging.connector.api.source.SourceTask;

public abstract class BaseJmsSourceTask extends SourceTask {

    private static final Logger log = LoggerFactory.getLogger(BaseJmsSourceTask.class);

    private Replicator replicator;

    private Config config;

    private ByteBuffer sourcePartition;

    @Override
    public Collection<SourceDataEntry> poll() {
        List<SourceDataEntry> res = new ArrayList<>();
        try {
            Message message = replicator.getQueue().poll(1000, TimeUnit.MILLISECONDS);
            if (message != null) {
                Object[] payload = new Object[] { config.getDestinationType(), config.getDestinationName(), getMessageContent(message) };
                SourceDataEntry sourceDataEntry = new SourceDataEntry(sourcePartition, null, System.currentTimeMillis(), EntryType.CREATE, null, null, payload);
                res.add(sourceDataEntry);
            }
        } catch (Exception e) {
            log.error("activemq task poll error, current config:" + JSON.toJSONString(config), e);
        }
        return res;
    }

    @Override
    public void start(KeyValue props) {
        try {
            this.config = new Config();
            this.config.load(props);
            this.sourcePartition = ByteBuffer.wrap(config.getBrokerUrl().getBytes("UTF-8"));
            this.replicator.start();
        } catch (Exception e) {
            log.error("activemq task start failed.", e);
            throw new DataConnectException(ErrorCode.START_ERROR_CODE, e.getMessage(), e);
        }
    }

    @Override
    public void stop() {
        try {
            replicator.stop();
        } catch (Exception e) {
            log.error("activemq task stop failed.", e);
            throw new DataConnectException(ErrorCode.STOP_ERROR_CODE, e.getMessage(), e);
        }
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }

    @SuppressWarnings("unchecked")
    public ByteBuffer getMessageContent(Message message) throws JMSException {
        byte

        if (message instanceof TextMessage) {
            data = ((TextMessage) message).getText().getBytes();
        } else if (message instanceof ObjectMessage) {
            data = JSON.toJSONBytes(((ObjectMessage) message).getObject());
        } else if (message instanceof BytesMessage) {
            BytesMessage bytesMessage = (BytesMessage) message;
            data = new byte[(int) bytesMessage.getBodyLength()];
            bytesMessage.readBytes(data);
        } else if (message instanceof MapMessage) {
            MapMessage mapMessage = (MapMessage) message;
            Map<String, Object> map = new HashMap<>();
            Enumeration<Object> names = mapMessage.getMapNames();
            while (names.hasMoreElements()) {
                String name = names.nextElement().toString();
                map.put(name, mapMessage.getObject(name));
            }
            data = JSON.toJSONBytes(map);
        } else if (message instanceof StreamMessage) {
            StreamMessage streamMessage = (StreamMessage) message;
            ByteArrayOutputStream bis = new ByteArrayOutputStream();
            byte[] by = new byte[1024];
            int i = 0;
            while ((i = streamMessage.readBytes(by)) != -1) {
                bis.write(by, 0, i);
            }
            data = bis.toByteArray();
        } else {
            // The exception is printed and does not need to be written as a DataConnectException
            throw new RuntimeException("message type exception");
        }
        return ByteBuffer.wrap(data);
    }

    public abstract Config getConfig();

    public abstract PatternProcessor getPatternProcessor(Replicator replicator);
}


while (names.hasMoreElements()) {
                String name = names.nextElement().toString();
                map.put(name, mapMessage.getObject(name));
            }

package org.apache.rocketmq.connect.jms.connector;

import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;
import org.apache.rocketmq.connect.jms.Config;
import org.apache.rocketmq.connect.jms.ErrorCode;
import org.apache.rocketmq.connect.jms.Replicator;
import org.apache.rocketmq.connect.jms.pattern.PatternProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSON;
import io.openmessaging.KeyValue;
import io.openmessaging.connector.api.data.EntryType;
import io.openmessaging.connector.api.data.SourceDataEntry;
import io.openmessaging.connector.api.exception.DataConnectException;
import io.openmessaging.connector.api.source.SourceTask;

public abstract class BaseJmsSourceTask extends SourceTask {

    private static final Logger log = LoggerFactory.getLogger(BaseJmsSourceTask.class);

    private Replicator replicator;

    private Config config;

    private ByteBuffer sourcePartition;

    @Override
    public Collection<SourceDataEntry> poll() {
        List<SourceDataEntry> res = new ArrayList<>();
        try {
            Message message = replicator.getQueue().poll(1000, TimeUnit.MILLISECONDS);
            if (message != null) {
                Object[] payload = new Object[] { config.getDestinationType(), config.getDestinationName(), getMessageContent(message) };
                SourceDataEntry sourceDataEntry = new SourceDataEntry(sourcePartition, null, System.currentTimeMillis(), EntryType.CREATE, null, null, payload);
                res.add(sourceDataEntry);
            }
        } catch (Exception e) {
            log.error("activemq task poll error, current config:" + JSON.toJSONString(config), e);
        }
        return res;
    }

    @Override
    public void start(KeyValue props) {
        try {
            this.config = new Config();
            this.config.load(props);
            this.sourcePartition = ByteBuffer.wrap(config.getBrokerUrl().getBytes("UTF-8"));
            this.replicator.start();
        } catch (Exception e) {
            log.error("activemq task start failed.", e);
            throw new DataConnectException(ErrorCode.START_ERROR_CODE, e.getMessage(), e);
        }
    }

    @Override
    public void stop() {
        try {
            replicator.stop();
        } catch (Exception e) {
            log.error("activemq task stop failed.", e);
            throw new DataConnectException(ErrorCode.STOP_ERROR_CODE, e.getMessage(), e);
        }
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }

    @SuppressWarnings("unchecked")
    public ByteBuffer getMessageContent(Message message) throws JMSException {
        byte[] data = null;
        if (message instanceof TextMessage) {
            data = ((TextMessage) message).getText().getBytes();
        } else if (message instanceof ObjectMessage) {
            data = JSON.toJSONBytes(((ObjectMessage) message).getObject());
        } else if (message instanceof BytesMessage) {
            BytesMessage bytesMessage = (BytesMessage) message;
            data = new byte[(int) bytesMessage.getBodyLength()];
            bytesMessage.readBytes(data);
        } else if (message instanceof MapMessage) {
            MapMessage mapMessage = (MapMessage) message;
            Map<String, Object> map = new HashMap<>();
            Enumeration<Object> names = mapMessage.getMapNames();

            data = JSON.toJSONBytes(map);
        } else if (message instanceof StreamMessage) {
            StreamMessage streamMessage = (StreamMessage) message;
            ByteArrayOutputStream bis = new ByteArrayOutputStream();
            byte[] by = new byte[1024];
            int i = 0;
            while ((i = streamMessage.readBytes(by)) != -1) {
                bis.write(by, 0, i);
            }
            data = bis.toByteArray();
        } else {
            // The exception is printed and does not need to be written as a DataConnectException
            throw new RuntimeException("message type exception");
        }
        return ByteBuffer.wrap(data);
    }

    public abstract Config getConfig();

    public abstract PatternProcessor getPatternProcessor(Replicator replicator);
}


try {
            replicator.stop();
        } catch (Exception e) {
            log.error("activemq task stop failed.", e);
            throw new DataConnectException(ErrorCode.STOP_ERROR_CODE, e.getMessage(), e);
        }

package org.apache.rocketmq.connect.jms.connector;

import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;
import org.apache.rocketmq.connect.jms.Config;
import org.apache.rocketmq.connect.jms.ErrorCode;
import org.apache.rocketmq.connect.jms.Replicator;
import org.apache.rocketmq.connect.jms.pattern.PatternProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSON;
import io.openmessaging.KeyValue;
import io.openmessaging.connector.api.data.EntryType;
import io.openmessaging.connector.api.data.SourceDataEntry;
import io.openmessaging.connector.api.exception.DataConnectException;
import io.openmessaging.connector.api.source.SourceTask;

public abstract class BaseJmsSourceTask extends SourceTask {

    private static final Logger log = LoggerFactory.getLogger(BaseJmsSourceTask.class);

    private Replicator replicator;

    private Config config;

    private ByteBuffer sourcePartition;

    @Override
    public Collection<SourceDataEntry> poll() {
        List<SourceDataEntry> res = new ArrayList<>();
        try {
            Message message = replicator.getQueue().poll(1000, TimeUnit.MILLISECONDS);
            if (message != null) {
                Object[] payload = new Object[] { config.getDestinationType(), config.getDestinationName(), getMessageContent(message) };
                SourceDataEntry sourceDataEntry = new SourceDataEntry(sourcePartition, null, System.currentTimeMillis(), EntryType.CREATE, null, null, payload);
                res.add(sourceDataEntry);
            }
        } catch (Exception e) {
            log.error("activemq task poll error, current config:" + JSON.toJSONString(config), e);
        }
        return res;
    }

    @Override
    public void start(KeyValue props) {
        try {
            this.config = new Config();
            this.config.load(props);
            this.sourcePartition = ByteBuffer.wrap(config.getBrokerUrl().getBytes("UTF-8"));
            this.replicator.start();
        } catch (Exception e) {
            log.error("activemq task start failed.", e);
            throw new DataConnectException(ErrorCode.START_ERROR_CODE, e.getMessage(), e);
        }
    }

    @Override
    public void stop() {

    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }

    @SuppressWarnings("unchecked")
    public ByteBuffer getMessageContent(Message message) throws JMSException {
        byte[] data = null;
        if (message instanceof TextMessage) {
            data = ((TextMessage) message).getText().getBytes();
        } else if (message instanceof ObjectMessage) {
            data = JSON.toJSONBytes(((ObjectMessage) message).getObject());
        } else if (message instanceof BytesMessage) {
            BytesMessage bytesMessage = (BytesMessage) message;
            data = new byte[(int) bytesMessage.getBodyLength()];
            bytesMessage.readBytes(data);
        } else if (message instanceof MapMessage) {
            MapMessage mapMessage = (MapMessage) message;
            Map<String, Object> map = new HashMap<>();
            Enumeration<Object> names = mapMessage.getMapNames();
            while (names.hasMoreElements()) {
                String name = names.nextElement().toString();
                map.put(name, mapMessage.getObject(name));
            }
            data = JSON.toJSONBytes(map);
        } else if (message instanceof StreamMessage) {
            StreamMessage streamMessage = (StreamMessage) message;
            ByteArrayOutputStream bis = new ByteArrayOutputStream();
            byte[] by = new byte[1024];
            int i = 0;
            while ((i = streamMessage.readBytes(by)) != -1) {
                bis.write(by, 0, i);
            }
            data = bis.toByteArray();
        } else {
            // The exception is printed and does not need to be written as a DataConnectException
            throw new RuntimeException("message type exception");
        }
        return ByteBuffer.wrap(data);
    }

    public abstract Config getConfig();

    public abstract PatternProcessor getPatternProcessor(Replicator replicator);
}


@Override
            public void onClick(View view)

package com.example.activitytest;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import android.app.Activity;
import android.content.Intent;

public class FirstActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);
        Button start = (Button) findViewById(R.id.start_button);
        start.setOnClickListener(new OnClickListener() {

{
                Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
                startActivityForResult(intent, 1);
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 1) {
            if (resultCode == RESULT_OK) {
                // here is your result
                String result = data.getStringExtra("result");
                Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
            }
            if (resultCode == RESULT_CANCELED) {
                // Write your code if there's no result
                Toast.makeText(getApplicationContext(), "Nothing Returned!", Toast.LENGTH_SHORT).show();
            }
        }
    }
}


{
                Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
                startActivityForResult(intent, 1);
            }

package com.example.activitytest;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import android.app.Activity;
import android.content.Intent;

public class FirstActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);
        Button start = (Button) findViewById(R.id.start_button);
        start.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View view)

        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 1) {
            if (resultCode == RESULT_OK) {
                // here is your result
                String result = data.getStringExtra("result");
                Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
            }
            if (resultCode == RESULT_CANCELED) {
                // Write your code if there's no result
                Toast.makeText(getApplicationContext(), "Nothing Returned!", Toast.LENGTH_SHORT).show();
            }
        }
    }
}


package com.example.activitytest;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import android.app.Activity;
import android.content.Intent;

public class FirstActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);
        Button start = (Button) findViewById(R.id.sta

        start.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View view) {
                Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
                startActivityForResult(intent, 1);
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 1) {
            if (resultCode == RESULT_OK) {
                // here is your result
                String result = data.getStringExtra("result");
                Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
            }
            if (resultCode == RESULT_CANCELED) {
                // Write your code if there's no result
                Toast.makeText(getApplicationContext(), "Nothing Returned!", Toast.LENGTH_SHORT).show();
            }
        }
    }
}


/*
 * This file is part of aion-lightning <aion-lightning.org>.
 *
 */
package quest.sanctum;

import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.questEngine.handlers.QuestHandler;
import com.aionemu.gameserver.questEngine.model.QuestDialog;
import com.aionemu.gameserver.questEngine.model.QuestEnv;
import com.aionemu.gameserver.questEngine.model.QuestState;
import com.aionemu.gameserver.questEngine.model.QuestStatus;

/**
 * Talk with Erdos (203740). Bring the Yellow Aether Powder (186000090) and Kinah (90000) to Flora (798384).
 *
 * @author undertrey
 * @modified vlog
 */
public class _3964GrowthFlorasFourthCharm extends QuestHandler {

    private final static int questId = 3964;

    public _3964GrowthFlorasFourthCharm() {
        super(questId);
    }

{
        qe.registerQuestNpc(798384).addOnQuestStart(questId);
        qe.registerQuestNpc(798384).addOnTalkEvent(questId);
        qe.registerQuestNpc(203740).addOnTalkEvent(questId);
    }

    @Override
    public boolean onDialogEvent(QuestEnv env) {
        final Player player = env.getPlayer();
        QuestState qs = player.getQuestStateList().getQuestState(questId);
        int targetId = 0;
        if (env.getVisibleObject() instanceof Npc)
            targetId = ((Npc) env.getVisibleObject()).getNpcId();
        if (qs == null || qs.getStatus() == QuestStatus.NONE) {
            if (targetId == 798384) {
                // Flora
                if (env.getDialog() == QuestDialog.START_DIALOG)
                    return sendQuestDialog(env, 1011);
                else
                    return sendQuestStartDialog(env);
            }
        } else if (qs.getStatus() == QuestStatus.START) {
            int var = qs.getQuestVarById(0);
            switch(targetId) {
                case 203740:
                    {
                        // Erdos
                        switch(env.getDialog()) {
                            case START_DIALOG:
                                if (var == 0)
                                    return sendQuestDialog(env, 1352);
                            case STEP_TO_1:
                                return defaultCloseDialog(env, 0, 1, 182206111, 1, 0, 0);
                        }
                    }
                case // Flora
                798384:
                    switch(env.getDialog()) {
                        case START_DIALOG:
                            if (var == 1) {
                                removeQuestItem(env, 182206111, 1);
                                return sendQuestDialog(env, 2375);
                            }
                        case CHECK_COLLECTED_ITEMS:
                            long itemAmount = player.getInventory().getItemCountByItemId(186000090);
                            if (var == 1 && player.getInventory().tryDecreaseKinah(90000) && itemAmount >= 1) {
                                player.getInventory().decreaseKinah(90000);
                                removeQuestItem(env, 186000090, 1);
                                // reward
                                changeQuestStep(env, 1, 1, true);
                                return sendQuestDialog(env, 5);
                            } else
                                return sendQuestDialog(env, 2716);
                        case FINISH_DIALOG:
                            return defaultCloseDialog(env, 1, 1);
                    }
            }
        } else if (qs.getStatus() == QuestStatus.REWARD) {
            if (targetId == 798384) {
                // Flora
                return sendQuestEndDialog(env);
            }
        }
        return false;
    }
}


{
        qe.registerQuestNpc(798384).addOnQuestStart(questId);
        qe.registerQuestNpc(798384).addOnTalkEvent(questId);
        qe.registerQuestNpc(203740).addOnTalkEvent(questId);
    }

/*
 * This file is part of aion-lightning <aion-lightning.org>.
 *
 */
package quest.sanctum;

import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.questEngine.handlers.QuestHandler;
import com.aionemu.gameserver.questEngine.model.QuestDialog;
import com.aionemu.gameserver.questEngine.model.QuestEnv;
import com.aionemu.gameserver.questEngine.model.QuestState;
import com.aionemu.gameserver.questEngine.model.QuestStatus;

/**
 * Talk with Erdos (203740). Bring the Yellow Aether Powder (186000090) and Kinah (90000) to Flora (798384).
 *
 * @author undertrey
 * @modified vlog
 */
public class _3964GrowthFlorasFourthCharm extends QuestHandler {

    private final static int questId = 3964;

    public _3964GrowthFlorasFourthCharm() {
        super(questId);
    }

    @Override
    public void register()

    @Override
    public boolean onDialogEvent(QuestEnv env) {
        final Player player = env.getPlayer();
        QuestState qs = player.getQuestStateList().getQuestState(questId);
        int targetId = 0;
        if (env.getVisibleObject() instanceof Npc)
            targetId = ((Npc) env.getVisibleObject()).getNpcId();
        if (qs == null || qs.getStatus() == QuestStatus.NONE) {
            if (targetId == 798384) {
                // Flora
                if (env.getDialog() == QuestDialog.START_DIALOG)
                    return sendQuestDialog(env, 1011);
                else
                    return sendQuestStartDialog(env);
            }
        } else if (qs.getStatus() == QuestStatus.START) {
            int var = qs.getQuestVarById(0);
            switch(targetId) {
                case 203740:
                    {
                        // Erdos
                        switch(env.getDialog()) {
                            case START_DIALOG:
                                if (var == 0)
                                    return sendQuestDialog(env, 1352);
                            case STEP_TO_1:
                                return defaultCloseDialog(env, 0, 1, 182206111, 1, 0, 0);
                        }
                    }
                case // Flora
                798384:
                    switch(env.getDialog()) {
                        case START_DIALOG:
                            if (var == 1) {
                                removeQuestItem(env, 182206111, 1);
                                return sendQuestDialog(env, 2375);
                            }
                        case CHECK_COLLECTED_ITEMS:
                            long itemAmount = player.getInventory().getItemCountByItemId(186000090);
                            if (var == 1 && player.getInventory().tryDecreaseKinah(90000) && itemAmount >= 1) {
                                player.getInventory().decreaseKinah(90000);
                                removeQuestItem(env, 186000090, 1);
                                // reward
                                changeQuestStep(env, 1, 1, true);
                                return sendQuestDialog(env, 5);
                            } else
                                return sendQuestDialog(env, 2716);
                        case FINISH_DIALOG:
                            return defaultCloseDialog(env, 1, 1);
                    }
            }
        } else if (qs.getStatus() == QuestStatus.REWARD) {
            if (targetId == 798384) {
                // Flora
                return sendQuestEndDialog(env);
            }
        }
        return false;
    }
}


/*
 * This file is part of aion-lightning <aion-lightning.org>.
 *
 */
package quest.sanctum;

import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.questEngine.handlers.QuestHandler;
import com.aionemu.gameserver.questEngine.model.QuestDialog;
import com.aionemu.gameserver.questEngine.model.QuestEnv;
import com.aionemu.gameserver.questEngine.model.QuestState;
import com.aionemu.gameserver.questEngine.model.QuestStatus;

/**
 * Talk with Erdos (203740). Bring the Yellow Aether Powder (186000090) and Kinah (90000) to Flora (798384).
 *
 * @author undertrey
 * @modified vlog
 */
public class _3964GrowthFlorasFourthCharm extends QuestHandler {

    private final static int questId = 3964;

    public _3964GrowthFlorasFourthCharm() {
        super(questId);
    }

    @Override
    public void register() {
        qe.registerQuestNpc(798384).addOnQuestStart(questId);
        qe.registerQuestNpc(798384).addOnTalkEvent(questId);
        qe.registerQuestNpc(203740).addOnTalkEvent(questId);
    }

    @Override
    public boolean onDialogEvent(QuestEnv env) {
        final Player player = env.getPlayer();
        QuestState qs = player.getQuestStateList().getQuestState(questId);
        int targ

        if (env.getVisibleObject() instanceof Npc)
            targetId = ((Npc) env.getVisibleObject()).getNpcId();
        if (qs == null || qs.getStatus() == QuestStatus.NONE) {
            if (targetId == 798384) {
                // Flora
                if (env.getDialog() == QuestDialog.START_DIALOG)
                    return sendQuestDialog(env, 1011);
                else
                    return sendQuestStartDialog(env);
            }
        } else if (qs.getStatus() == QuestStatus.START) {
            int var = qs.getQuestVarById(0);
            switch(targetId) {
                case 203740:
                    {
                        // Erdos
                        switch(env.getDialog()) {
                            case START_DIALOG:
                                if (var == 0)
                                    return sendQuestDialog(env, 1352);
                            case STEP_TO_1:
                                return defaultCloseDialog(env, 0, 1, 182206111, 1, 0, 0);
                        }
                    }
                case // Flora
                798384:
                    switch(env.getDialog()) {
                        case START_DIALOG:
                            if (var == 1) {
                                removeQuestItem(env, 182206111, 1);
                                return sendQuestDialog(env, 2375);
                            }
                        case CHECK_COLLECTED_ITEMS:
                            long itemAmount = player.getInventory().getItemCountByItemId(186000090);
                            if (var == 1 && player.getInventory().tryDecreaseKinah(90000) && itemAmount >= 1) {
                                player.getInventory().decreaseKinah(90000);
                                removeQuestItem(env, 186000090, 1);
                                // reward
                                changeQuestStep(env, 1, 1, true);
                                return sendQuestDialog(env, 5);
                            } else
                                return sendQuestDialog(env, 2716);
                        case FINISH_DIALOG:
                            return defaultCloseDialog(env, 1, 1);
                    }
            }
        } else if (qs.getStatus() == QuestStatus.REWARD) {
            if (targetId == 798384) {
                // Flora
                return sendQuestEndDialog(env);
            }
        }
        return false;
    }
}


switch(env.getDialog()) {
                            case START_DIALOG:
                                if (var == 0)
                                    return sendQuestDialog(env, 1352);
                            case STEP_TO_1:
                                return defaultCloseDialog(env, 0, 1, 182206111, 1, 0, 0);
                        }

/*
 * This file is part of aion-lightning <aion-lightning.org>.
 *
 */
package quest.sanctum;

import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.questEngine.handlers.QuestHandler;
import com.aionemu.gameserver.questEngine.model.QuestDialog;
import com.aionemu.gameserver.questEngine.model.QuestEnv;
import com.aionemu.gameserver.questEngine.model.QuestState;
import com.aionemu.gameserver.questEngine.model.QuestStatus;

/**
 * Talk with Erdos (203740). Bring the Yellow Aether Powder (186000090) and Kinah (90000) to Flora (798384).
 *
 * @author undertrey
 * @modified vlog
 */
public class _3964GrowthFlorasFourthCharm extends QuestHandler {

    private final static int questId = 3964;

    public _3964GrowthFlorasFourthCharm() {
        super(questId);
    }

    @Override
    public void register() {
        qe.registerQuestNpc(798384).addOnQuestStart(questId);
        qe.registerQuestNpc(798384).addOnTalkEvent(questId);
        qe.registerQuestNpc(203740).addOnTalkEvent(questId);
    }

    @Override
    public boolean onDialogEvent(QuestEnv env) {
        final Player player = env.getPlayer();
        QuestState qs = player.getQuestStateList().getQuestState(questId);
        int targetId = 0;
        if (env.getVisibleObject() instanceof Npc)
            targetId = ((Npc) env.getVisibleObject()).getNpcId();
        if (qs == null || qs.getStatus() == QuestStatus.NONE) {
            if (targetId == 798384) {
                // Flora
                if (env.getDialog() == QuestDialog.START_DIALOG)
                    return sendQuestDialog(env, 1011);
                else
                    return sendQuestStartDialog(env);
            }
        } else if (qs.getStatus() == QuestStatus.START) {
            int var = qs.getQuestVarById(0);
            switch(targetId) {
                case 203740:
                    {
                        // Erdos

                    }
                case // Flora
                798384:
                    switch(env.getDialog()) {
                        case START_DIALOG:
                            if (var == 1) {
                                removeQuestItem(env, 182206111, 1);
                                return sendQuestDialog(env, 2375);
                            }
                        case CHECK_COLLECTED_ITEMS:
                            long itemAmount = player.getInventory().getItemCountByItemId(186000090);
                            if (var == 1 && player.getInventory().tryDecreaseKinah(90000) && itemAmount >= 1) {
                                player.getInventory().decreaseKinah(90000);
                                removeQuestItem(env, 186000090, 1);
                                // reward
                                changeQuestStep(env, 1, 1, true);
                                return sendQuestDialog(env, 5);
                            } else
                                return sendQuestDialog(env, 2716);
                        case FINISH_DIALOG:
                            return defaultCloseDialog(env, 1, 1);
                    }
            }
        } else if (qs.getStatus() == QuestStatus.REWARD) {
            if (targetId == 798384) {
                // Flora
                return sendQuestEndDialog(env);
            }
        }
        return false;
    }
}


/*
 * HaoRan ImageFilter Classes v0.1
 *
 */
package HaoRan.ImageFilter;

/**
 * 光照效果
 * @author daizhj
 */
public class LightFilter extends RadialDistortionFilter {

    public float Light = 150.0f;

    // @Override

{
        int width = imageIn.getWidth();
        int halfw = width / 2;
        int height = imageIn.getHeight();
        int halfh = height / 2;
        int R = Math.min(halfw, halfh);
        // 中心点，发亮此值会让强光中心发生偏移
        Point point = new Point(halfw, halfh);
        int r = 0, g = 0, b = 0;
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                float length = (float) Math.sqrt(Math.pow((x - point.X), 2) + Math.pow((y - point.Y), 2));
                r = imageIn.getRComponent(x, y);
                g = imageIn.getGComponent(x, y);
                b = imageIn.getBComponent(x, y);
                // 位于光晕中
                if (length < R) {
                    float pixel = Light * (1.0f - length / R);
                    r = r + (int) pixel;
                    r = Math.max(0, Math.min(r, 255));
                    g = g + (int) pixel;
                    g = Math.max(0, Math.min(g, 255));
                    b = b + (int) pixel;
                    b = Math.max(0, Math.min(b, 255));
                }
                imageIn.setPixelColor(x, y, r, g, b);
            }
        }
        return imageIn;
    }
}


/*
 * HaoRan ImageFilter Classes v0.1
 *
 */
package HaoRan.ImageFilter;

/**
 * 光照效果
 * @author daizhj
 */
public class LightFilter extends RadialDistortionFilter {

    public float Light = 150.0f;

    // @Override
    public Image process(Image imageIn) {
        int width = imageIn.getWidth();
        int hal

        int height = imageIn.getHeight();
        int halfh = height / 2;
        int R = Math.min(halfw, halfh);
        // 中心点，发亮此值会让强光中心发生偏移
        Point point = new Point(halfw, halfh);
        int r = 0, g = 0, b = 0;
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                float length = (float) Math.sqrt(Math.pow((x - point.X), 2) + Math.pow((y - point.Y), 2));
                r = imageIn.getRComponent(x, y);
                g = imageIn.getGComponent(x, y);
                b = imageIn.getBComponent(x, y);
                // 位于光晕中
                if (length < R) {
                    float pixel = Light * (1.0f - length / R);
                    r = r + (int) pixel;
                    r = Math.max(0, Math.min(r, 255));
                    g = g + (int) pixel;
                    g = Math.max(0, Math.min(g, 255));
                    b = b + (int) pixel;
                    b = Math.max(0, Math.min(b, 255));
                }
                imageIn.setPixelColor(x, y, r, g, b);
            }
        }
        return imageIn;
    }
}


public int read(byte[] b, int off, int len)

/* StringBufferInputStream.java -- Read an String as a stream

*/
package java.io;

/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
 * "The Java Language Specification", ISBN 0-201-63451-1
 * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
 * Status:  Believed complete and correct.  Deprecated in JDK 1.1.
 */
/**
 * This class permits a String to be read as an input stream.
 * The low eight bits of each character in the String are the
 * bytes that are returned. The high eight bits of each character are
 * discarded.
 *

 * The mark/reset functionality in this class behaves differently than
 * normal.  The mark() method is always ignored and the
 * reset() method always resets in stream to start reading from
 * position 0 in the String.  Note that since this method does not override
 * markSupported() in InputStream, calling that
 * method will return false.
 *

 * Note that this class is deprecated because it does not properly handle
 * 16-bit Java characters.  It is provided for backwards compatibility only
 * and should not be used for new development.  The StringReader
 * class should be used instead.
 *
 * @deprecated
 *
 * @author Aaron M. Renn (example@nnthink.com)
 * @author Warren Levy (example@nnthink.com)
 */
public class StringBufferInputStream extends InputStream {

    /**
     * The String which is the input to this stream.
     */
    protected String buffer;

    /**
     * Position of the next byte in buffer to be read.
     */
    protected int pos = 0;

    /**
     * The length of the String buffer.
     */
    protected int count;

    /**
     * Create a new StringBufferInputStream that will read bytes
     * from the passed in String.  This stream will read from the
     * beginning to the end of the String.
     *
     * @param s The String this stream will read from.
     */
    public StringBufferInputStream(String s) {
        buffer = s;
        count = s.length();
    }

    /**
     * This method returns the number of bytes available to be read from this
     * stream.  The value returned will be equal to count - pos.
     *
     * @return The number of bytes that can be read from this stream before
     * blocking, which is all of them
     */
    public int available() {
        return count - pos;
    }

    /**
     * This method reads one byte from the stream.  The pos counter
     * is advanced to the next byte to be read.  The byte read is returned as
     * an int in the range of 0-255.  If the stream position is already at the
     * end of the buffer, no byte is read and a -1 is returned in order to
     * indicate the end of the stream.
     *
     * @return The byte read, or -1 if end of stream
     */
    public int read() {
        if (pos >= count)
            // EOF
            return -1;
        return ((int) buffer.charAt(pos++)) & 0xFF;
    }

    /**
     * This method reads bytes from the stream and stores them into a caller
     * supplied buffer.  It starts storing the data at index offset
     * into the buffer and attempts to read len bytes.  This method
     * can return before reading the number of bytes requested if the end of the
     * stream is encountered first.  The actual number of bytes read is
     * returned.  If no bytes can be read because the stream is already at
     * the end of stream position, a -1 is returned.
     *

     * This method does not block.
     *
     * @param b The array into which the bytes read should be stored.
     * @param off The offset into the array to start storing bytes
     * @param len The requested number of bytes to read
     *
     * @return The actual number of bytes read, or -1 if end of stream.
     */

{
        if (off < 0 || len < 0 || off + len > b.length)
            throw new ArrayIndexOutOfBoundsException();
        if (pos >= count)
            // EOF
            return -1;
        int numRead = Math.min(len, count - pos);
        if (numRead < 0)
            return 0;
        buffer.getBytes(pos, pos + numRead, b, off);
        pos += numRead;
        return numRead;
    }

    /**
     * This method sets the read position in the stream to the beginning
     * setting the pos variable equal to 0.  Note that this differs
     * from the common implementation of the reset() method.
     */
    public void reset() {
        pos = 0;
    }

    /**
     * This method attempts to skip the requested number of bytes in the
     * input stream.  It does this by advancing the pos value by the
     * specified number of bytes.  It this would exceed the length of the
     * buffer, then only enough bytes are skipped to position the stream at
     * the end of the buffer.  The actual number of bytes skipped is returned.
     *
     * @param n The requested number of bytes to skip
     *
     * @return The actual number of bytes skipped.
     */
    public long skip(long n) {
        if (n < 0)
            return 0L;
        long actualSkip = Math.min(n, count - pos);
        pos += actualSkip;
        return actualSkip;
    }
}


{
        if (off < 0 || len < 0 || off + len > b.length)
            throw new ArrayIndexOutOfBoundsException();
        if (pos >= count)
            // EOF
            return -1;
        int numRead = Math.min(len, count - pos);
        if (numRead < 0)
            return 0;
        buffer.getBytes(pos, pos + numRead, b, off);
        pos += numRead;
        return numRead;
    }

/* StringBufferInputStream.java -- Read an String as a stream

*/
package java.io;

/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
 * "The Java Language Specification", ISBN 0-201-63451-1
 * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
 * Status:  Believed complete and correct.  Deprecated in JDK 1.1.
 */
/**
 * This class permits a String to be read as an input stream.
 * The low eight bits of each character in the String are the
 * bytes that are returned. The high eight bits of each character are
 * discarded.
 *

 * The mark/reset functionality in this class behaves differently than
 * normal.  The mark() method is always ignored and the
 * reset() method always resets in stream to start reading from
 * position 0 in the String.  Note that since this method does not override
 * markSupported() in InputStream, calling that
 * method will return false.
 *

 * Note that this class is deprecated because it does not properly handle
 * 16-bit Java characters.  It is provided for backwards compatibility only
 * and should not be used for new development.  The StringReader
 * class should be used instead.
 *
 * @deprecated
 *
 * @author Aaron M. Renn (example@nnthink.com)
 * @author Warren Levy (example@nnthink.com)
 */
public class StringBufferInputStream extends InputStream {

    /**
     * The String which is the input to this stream.
     */
    protected String buffer;

    /**
     * Position of the next byte in buffer to be read.
     */
    protected int pos = 0;

    /**
     * The length of the String buffer.
     */
    protected int count;

    /**
     * Create a new StringBufferInputStream that will read bytes
     * from the passed in String.  This stream will read from the
     * beginning to the end of the String.
     *
     * @param s The String this stream will read from.
     */
    public StringBufferInputStream(String s) {
        buffer = s;
        count = s.length();
    }

    /**
     * This method returns the number of bytes available to be read from this
     * stream.  The value returned will be equal to count - pos.
     *
     * @return The number of bytes that can be read from this stream before
     * blocking, which is all of them
     */
    public int available() {
        return count - pos;
    }

    /**
     * This method reads one byte from the stream.  The pos counter
     * is advanced to the next byte to be read.  The byte read is returned as
     * an int in the range of 0-255.  If the stream position is already at the
     * end of the buffer, no byte is read and a -1 is returned in order to
     * indicate the end of the stream.
     *
     * @return The byte read, or -1 if end of stream
     */
    public int read() {
        if (pos >= count)
            // EOF
            return -1;
        return ((int) buffer.charAt(pos++)) & 0xFF;
    }

    /**
     * This method reads bytes from the stream and stores them into a caller
     * supplied buffer.  It starts storing the data at index offset
     * into the buffer and attempts to read len bytes.  This method
     * can return before reading the number of bytes requested if the end of the
     * stream is encountered first.  The actual number of bytes read is
     * returned.  If no bytes can be read because the stream is already at
     * the end of stream position, a -1 is returned.
     *

     * This method does not block.
     *
     * @param b The array into which the bytes read should be stored.
     * @param off The offset into the array to start storing bytes
     * @param len The requested number of bytes to read
     *
     * @return The actual number of bytes read, or -1 if end of stream.
     */
    public int read(byte[] b, int off, int len)

/**
     * This method sets the read position in the stream to the beginning
     * setting the pos variable equal to 0.  Note that this differs
     * from the common implementation of the reset() method.
     */
    public void reset() {
        pos = 0;
    }

    /**
     * This method attempts to skip the requested number of bytes in the
     * input stream.  It does this by advancing the pos value by the
     * specified number of bytes.  It this would exceed the length of the
     * buffer, then only enough bytes are skipped to position the stream at
     * the end of the buffer.  The actual number of bytes skipped is returned.
     *
     * @param n The requested number of bytes to skip
     *
     * @return The actual number of bytes skipped.
     */
    public long skip(long n) {
        if (n < 0)
            return 0L;
        long actualSkip = Math.min(n, count - pos);
        pos += actualSkip;
        return actualSkip;
    }
}


/* StringBufferInputStream.java -- Read an String as a stream

*/
package java.io;

/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
 * "The Java Language Specification", ISBN 0-201-63451-1
 * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
 * Status:  Believed complete and correct.  Deprecated in JDK 1.1.
 */
/**
 * This class permits a String to be read as an input stream.
 * The low eight bits of each character in the String are the
 * bytes that are returned. The high eight bits of each character are
 * discarded.
 *

 * The mark/reset functionality in this class behaves differently than
 * normal.  The mark() method is always ignored and the
 * reset() method always resets in stream to start reading from
 * position 0 in the String.  Note that since this method does not override
 * markSupported() in InputStream, calling that
 * method will return false.
 *

 * Note that this class is deprecated because it does not properly handle
 * 16-bit Java characters.  It is provided for backwards compatibility only
 * and should not be used for new development.  The StringReader
 * class should be used instead.
 *
 * @deprecated
 *
 * @author Aaron M. Renn (example@nnthink.com)
 * @author Warren Levy (example@nnthink.com)
 */
public class StringBufferInputStream extends InputStream {

    /**
     * The String which is the input to this stream.
     */
    protected String buffer;

    /**
     * Position of the next byte in buffer to be read.
     */
    protected int pos = 0;

    /**
     * The length of the String buffer.
     */
    protected int count;

    /**
     * Create a new StringBufferInputStream that will read bytes
     * from the passed in String.  This stream will read from the
     * beginning to the end of the String.
     *
     * @param s The String this stream will read from.
     */
    public StringBufferInputStream(String s) {
        buffer = s;
        count = s.length();
    }

    /**
     * This method returns the number of bytes available to be read from this
     * stream.  The value returned will be equal to count - pos.
     *
     * @return The number of bytes that can be read from this stream before
     * blocking, which is all of them
     */
    public int available() {
        return count - pos;
    }

    /**
     * This method reads one byte from the stream.  The pos counter
     * is advanced to the next byte to be read.  The byte read is returned as
     * an int in the range of 0-255.  If the stream position is already at the
     * end of the buffer, no byte is read and a -1 is returned in order to
     * indicate the end of the stream.
     *
     * @return The byte read, or -1 if end of stream
     */
    public int read() {
        if (pos >= count)
            // EOF
            return -1;
        return ((int) buffer.

}

    /**
     * This method reads bytes from the stream and stores them into a caller
     * supplied buffer.  It starts storing the data at index offset
     * into the buffer and attempts to read len bytes.  This method
     * can return before reading the number of bytes requested if the end of the
     * stream is encountered first.  The actual number of bytes read is
     * returned.  If no bytes can be read because the stream is already at
     * the end of stream position, a -1 is returned.
     *

     * This method does not block.
     *
     * @param b The array into which the bytes read should be stored.
     * @param off The offset into the array to start storing bytes
     * @param len The requested number of bytes to read
     *
     * @return The actual number of bytes read, or -1 if end of stream.
     */
    public int read(byte[] b, int off, int len) {
        if (off < 0 || len < 0 || off + len > b.length)
            throw new ArrayIndexOutOfBoundsException();
        if (pos >= count)
            // EOF
            return -1;
        int numRead = Math.min(len, count - pos);
        if (numRead < 0)
            return 0;
        buffer.getBytes(pos, pos + numRead, b, off);
        pos += numRead;
        return numRead;
    }

    /**
     * This method sets the read position in the stream to the beginning
     * setting the pos variable equal to 0.  Note that this differs
     * from the common implementation of the reset() method.
     */
    public void reset() {
        pos = 0;
    }

    /**
     * This method attempts to skip the requested number of bytes in the
     * input stream.  It does this by advancing the pos value by the
     * specified number of bytes.  It this would exceed the length of the
     * buffer, then only enough bytes are skipped to position the stream at
     * the end of the buffer.  The actual number of bytes skipped is returned.
     *
     * @param n The requested number of bytes to skip
     *
     * @return The actual number of bytes skipped.
     */
    public long skip(long n) {
        if (n < 0)
            return 0L;
        long actualSkip = Math.min(n, count - pos);
        pos += actualSkip;
        return actualSkip;
    }
}


public void reset() {
        pos = 0;
    }

/* StringBufferInputStream.java -- Read an String as a stream

*/
package java.io;

/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
 * "The Java Language Specification", ISBN 0-201-63451-1
 * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
 * Status:  Believed complete and correct.  Deprecated in JDK 1.1.
 */
/**
 * This class permits a String to be read as an input stream.
 * The low eight bits of each character in the String are the
 * bytes that are returned. The high eight bits of each character are
 * discarded.
 *

 * The mark/reset functionality in this class behaves differently than
 * normal.  The mark() method is always ignored and the
 * reset() method always resets in stream to start reading from
 * position 0 in the String.  Note that since this method does not override
 * markSupported() in InputStream, calling that
 * method will return false.
 *

 * Note that this class is deprecated because it does not properly handle
 * 16-bit Java characters.  It is provided for backwards compatibility only
 * and should not be used for new development.  The StringReader
 * class should be used instead.
 *
 * @deprecated
 *
 * @author Aaron M. Renn (example@nnthink.com)
 * @author Warren Levy (example@nnthink.com)
 */
public class StringBufferInputStream extends InputStream {

    /**
     * The String which is the input to this stream.
     */
    protected String buffer;

    /**
     * Position of the next byte in buffer to be read.
     */
    protected int pos = 0;

    /**
     * The length of the String buffer.
     */
    protected int count;

    /**
     * Create a new StringBufferInputStream that will read bytes
     * from the passed in String.  This stream will read from the
     * beginning to the end of the String.
     *
     * @param s The String this stream will read from.
     */
    public StringBufferInputStream(String s) {
        buffer = s;
        count = s.length();
    }

    /**
     * This method returns the number of bytes available to be read from this
     * stream.  The value returned will be equal to count - pos.
     *
     * @return The number of bytes that can be read from this stream before
     * blocking, which is all of them
     */
    public int available() {
        return count - pos;
    }

    /**
     * This method reads one byte from the stream.  The pos counter
     * is advanced to the next byte to be read.  The byte read is returned as
     * an int in the range of 0-255.  If the stream position is already at the
     * end of the buffer, no byte is read and a -1 is returned in order to
     * indicate the end of the stream.
     *
     * @return The byte read, or -1 if end of stream
     */
    public int read() {
        if (pos >= count)
            // EOF
            return -1;
        return ((int) buffer.charAt(pos++)) & 0xFF;
    }

    /**
     * This method reads bytes from the stream and stores them into a caller
     * supplied buffer.  It starts storing the data at index offset
     * into the buffer and attempts to read len bytes.  This method
     * can return before reading the number of bytes requested if the end of the
     * stream is encountered first.  The actual number of bytes read is
     * returned.  If no bytes can be read because the stream is already at
     * the end of stream position, a -1 is returned.
     *

     * This method does not block.
     *
     * @param b The array into which the bytes read should be stored.
     * @param off The offset into the array to start storing bytes
     * @param len The requested number of bytes to read
     *
     * @return The actual number of bytes read, or -1 if end of stream.
     */
    public int read(byte[] b, int off, int len) {
        if (off < 0 || len < 0 || off + len > b.length)
            throw new ArrayIndexOutOfBoundsException();
        if (pos >= count)
            // EOF
            return -1;
        int numRead = Math.min(len, count - pos);
        if (numRead < 0)
            return 0;
        buffer.getBytes(pos, pos + numRead, b, off);
        pos += numRead;
        return numRead;
    }

    /**
     * This method sets the read position in the stream to the beginning
     * setting the pos variable equal to 0.  Note that this differs
     * from the common implementation of the reset() method.
     */

/**
     * This method attempts to skip the requested number of bytes in the
     * input stream.  It does this by advancing the pos value by the
     * specified number of bytes.  It this would exceed the length of the
     * buffer, then only enough bytes are skipped to position the stream at
     * the end of the buffer.  The actual number of bytes skipped is returned.
     *
     * @param n The requested number of bytes to skip
     *
     * @return The actual number of bytes skipped.
     */
    public long skip(long n) {
        if (n < 0)
            return 0L;
        long actualSkip = Math.min(n, count - pos);
        pos += actualSkip;
        return actualSkip;
    }
}


package org.atteo.xmlcombiner;

import java.util.Map;

/**
 * Element name and the value of it's 'id' attribute if exists.
 */
class Key {

    public static final Key BEFORE_END = new Key("", null);

    private final String name;

    private final Map<String, String> keys;

    public Key(String name, Map<String, String> keys) {
        this.name = name;
        this.keys = keys;
    }

    @Override
    public int hashCode() {
        int hash = 1;
        if (name != null) {
            hash += name.hashCode();
        }
        if (keys != null) {
            hash = hash * 37 + keys.hashCode();
        }
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Key other = (Key) obj;
        if ((name == null) ? (other.getName() != null) : !name.equals(other.getName())) {
            return false;
        }
        if ((keys == null) ? (other.getId() != null) : !keys.equals(other.getId())) {
            return false;
        }
        return true;
    }

    public Map<String, String> getId() {
        return keys;
    }

    public String getName() {
        return name;
    }

{
        if (keys != null) {
            return name + "#" + keys;
        } else {
            return name;
        }
    }
}


{
        int hash = 1;
        if (name != null) {
            hash += name.hashCode();
        }
        if (keys != null) {
            hash = hash * 37 + keys.hashCode();
        }
        return hash;
    }

package org.atteo.xmlcombiner;

import java.util.Map;

/**
 * Element name and the value of it's 'id' attribute if exists.
 */
class Key {

    public static final Key BEFORE_END = new Key("", null);

    private final String name;

    private final Map<String, String> keys;

    public Key(String name, Map<String, String> keys) {
        this.name = name;
        this.keys = keys;
    }

    @Override
    public int hashCode()

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Key other = (Key) obj;
        if ((name == null) ? (other.getName() != null) : !name.equals(other.getName())) {
            return false;
        }
        if ((keys == null) ? (other.getId() != null) : !keys.equals(other.getId())) {
            return false;
        }
        return true;
    }

    public Map<String, String> getId() {
        return keys;
    }

    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        if (keys != null) {
            return name + "#" + keys;
        } else {
            return name;
        }
    }
}


package org.atteo.xmlcombiner;

import java.util.Map;

/**
 * Element name and the value of it's 'id' attribute if exists.
 */
class Key {

    public static final Key BEFORE_END = new Key("", null);

    private final String name;

    private final Map<String, String> keys;

    public Key(String name, Map<String, String> keys) {
        this.name = name;
        this.keys = keys;
    }

    @Override
    public int hashCode() {
        int hash = 1;
        if (name != null) {
            hash += name.hashCode();
        }
        if (keys != null) {
            hash = hash * 37 + keys.hashCode();
        }
        retu

    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Key other = (Key) obj;
        if ((name == null) ? (other.getName() != null) : !name.equals(other.getName())) {
            return false;
        }
        if ((keys == null) ? (other.getId() != null) : !keys.equals(other.getId())) {
            return false;
        }
        return true;
    }

    public Map<String, String> getId() {
        return keys;
    }

    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        if (keys != null) {
            return name + "#" + keys;
        } else {
            return name;
        }
    }
}


/*
 * Tanaguru - Automated webpage assessment
 *
 *
 * Contact us by mail: tanaguru AT tanaguru DOT org
 */
package org.tanaguru.rules.rgaa32016;

import java.util.Collections;
import org.apache.commons.lang3.tuple.ImmutablePair;
import static org.tanaguru.entity.audit.TestSolution.FAILED;
import static org.tanaguru.entity.audit.TestSolution.NEED_MORE_INFO;
import static org.tanaguru.entity.audit.TestSolution.PASSED;
import org.tanaguru.ruleimplementation.AbstractMarkerPageRuleImplementation;
import org.tanaguru.rules.elementchecker.CompositeChecker;
import org.tanaguru.rules.elementchecker.ElementChecker;
import org.tanaguru.rules.elementchecker.attribute.AttributePresenceChecker;
import org.tanaguru.rules.elementchecker.text.TextEmptinessChecker;
import org.tanaguru.rules.elementselector.AreaElementSelector;
import org.tanaguru.rules.elementselector.ImageElementSelector;
import static org.tanaguru.rules.keystore.AttributeStore.ALT_ATTR;
import static org.tanaguru.rules.keystore.AttributeStore.ARIA_DESCRIBEDBY_ATTR;
import static org.tanaguru.rules.keystore.AttributeStore.ARIA_LABELLEDBY_ATTR;
import static org.tanaguru.rules.keystore.AttributeStore.ARIA_LABEL_ATTR;
import static org.tanaguru.rules.keystore.AttributeStore.TITLE_ATTR;
import static org.tanaguru.rules.keystore.MarkerStore.DECORATIVE_IMAGE_MARKER;
import static org.tanaguru.rules.keystore.MarkerStore.INFORMATIVE_IMAGE_MARKER;
import org.tanaguru.rules.keystore.RemarkMessageStore;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_ARIA_DESCRIBEDBY_ATTR_MSG;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_ARIA_LABELLEDBY_ATTR_MSG;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_ARIA_LABEL_ATTR_MSG;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_TITLE_ATTR_MSG;
import org.tanaguru.rules.textbuilder.TextAttributeOfElementBuilder;

/**
 * Implementation of the rule 1.2.2 of the referential Rgaa 3-2016.
 *

 * For more details about the implementation, refer to the
 * rule 1.2.2 design page.
 *
 * @see
 * 1.2.2 rule specification
 */
public class Rgaa32016Rule010202 extends AbstractMarkerPageRuleImplementation {

    public Rgaa32016Rule010202() {
        super(// the decorative images are part of the scope
        DECORATIVE_IMAGE_MARKER, // the informative images are not part of the scope
        INFORMATIVE_IMAGE_MARKER);
        setElementSelector(new ImageElementSelector(new AreaElementSelector(true, true, false), true, false));
        setMarkerElementChecker(getMarkerElementChecker());
        setRegularElementChecker(getLocalRegularElementChecker());
    }

    /**
     * @return the checker user for marked elements
     */
    private ElementChecker getMarkerElementChecker() {
        CompositeChecker ec = new CompositeChecker(new TextEmptinessChecker(new TextAttributeOfElementBuilder(ALT_ATTR), new ImmutablePair(PASSED, ""), new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG), ALT_ATTR, TITLE_ATTR), // Checker sur la présence de l'attribut title
        new AttributePresenceChecker(TITLE_ATTR, new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_TITLE_ATTR_MSG), new ImmutablePair(PASSED, ""), TITLE_ATTR), // checker sur la présence de l'attribut aria-label
        new AttributePresenceChecker(ARIA_LABEL_ATTR, new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_ARIA_LABEL_ATTR_MSG), new ImmutablePair(PASSED, ""), ARIA_LABEL_ATTR), // checker sur la présence de l'attribut aria-labelledby
        new AttributePresenceChecker(ARIA_LABELLEDBY_ATTR, new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_ARIA_LABELLEDBY_ATTR_MSG), new ImmutablePair(PASSED, ""), ARIA_LABELLEDBY_ATTR), // checker sur la présence de l'attribut aria-describedby
        new AttributePresenceChecker(ARIA_DESCRIBEDBY_ATTR, new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_ARIA_DESCRIBEDBY_ATTR_MSG), new ImmutablePair(PASSED, ""), ARIA_DESCRIBEDBY_ATTR));
        ec.setIsOrCombinaison(false);
        return ec;
    }

    /**
     * @return the checker user for not marked elements
     */

{
        CompositeChecker compositeChecker = new CompositeChecker(new TextEmptinessChecker(new TextAttributeOfElementBuilder(ALT_ATTR), new ImmutablePair(PASSED, ""), new ImmutablePair(FAILED, "")), new AttributePresenceChecker(TITLE_ATTR, new ImmutablePair(FAILED, ""), new ImmutablePair(PASSED, "")));
        compositeChecker.setIsOrCombinaison(false);
        compositeChecker.addCheckMessageFromSolution(PASSED, Collections.singletonMap(NEED_MORE_INFO, RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_EMPTY_ALT_MSG));
        compositeChecker.addCheckMessageFromSolution(FAILED, Collections.singletonMap(NEED_MORE_INFO, RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_NOT_EMPTY_ALT_MSG));
        return compositeChecker;
    }
}


/*
 * Tanaguru - Automated webpage assessment
 *
 *
 * Contact us by mail: tanaguru AT tanaguru DOT org
 */
package org.tanaguru.rules.rgaa32016;

import java.util.Collections;
import org.apache.commons.lang3.tuple.ImmutablePair;
import static org.tanaguru.entity.audit.TestSolution.FAILED;
import static org.tanaguru.entity.audit.TestSolution.NEED_MORE_INFO;
import static org.tanaguru.entity.audit.TestSolution.PASSED;
import org.tanaguru.ruleimplementation.AbstractMarkerPageRuleImplementation;
import org.tanaguru.rules.elementchecker.CompositeChecker;
import org.tanaguru.rules.elementchecker.ElementChecker;
import org.tanaguru.rules.elementchecker.attribute.AttributePresenceChecker;
import org.tanaguru.rules.elementchecker.text.TextEmptinessChecker;
import org.tanaguru.rules.elementselector.AreaElementSelector;
import org.tanaguru.rules.elementselector.ImageElementSelector;
import static org.tanaguru.rules.keystore.AttributeStore.ALT_ATTR;
import static org.tanaguru.rules.keystore.AttributeStore.ARIA_DESCRIBEDBY_ATTR;
import static org.tanaguru.rules.keystore.AttributeStore.ARIA_LABELLEDBY_ATTR;
import static org.tanaguru.rules.keystore.AttributeStore.ARIA_LABEL_ATTR;
import static org.tanaguru.rules.keystore.AttributeStore.TITLE_ATTR;
import static org.tanaguru.rules.keystore.MarkerStore.DECORATIVE_IMAGE_MARKER;
import static org.tanaguru.rules.keystore.MarkerStore.INFORMATIVE_IMAGE_MARKER;
import org.tanaguru.rules.keystore.RemarkMessageStore;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_ARIA_DESCRIBEDBY_ATTR_MSG;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_ARIA_LABELLEDBY_ATTR_MSG;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_ARIA_LABEL_ATTR_MSG;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG;
import static org.tanaguru.rules.keystore.RemarkMessageStore.DECORATIVE_ELEMENT_WITH_TITLE_ATTR_MSG;
import org.tanaguru.rules.textbuilder.TextAttributeOfElementBuilder;

/**
 * Implementation of the rule 1.2.2 of the referential Rgaa 3-2016.
 *

 * For more details about the implementation, refer to the
 * rule 1.2.2 design page.
 *
 * @see
 * 1.2.2 rule specification
 */
public class Rgaa32016Rule010202 extends AbstractMarkerPageRuleImplementation {

    public Rgaa32016Rule010202() {
        super(// the decorative images are part of the scope
        DECORATIVE_IMAGE_MARKER, // the informative images are not part of the scope
        INFORMATIVE_IMAGE_MARKER);
        setElementSelector(new ImageElementSelector(new AreaElementSelector(true, true, false), true, false));
        setMarkerElementChecker(getMarkerElementChecker());
        setRegularElementChecker(getLocalRegularElementChecker());
    }

    /**
     * @return the checker user for marked elements
     */
    private ElementChecker getMarkerElementChecker() {
        CompositeChecker ec = new CompositeChecker(new TextEmptinessChecker(new TextAttributeOfElementBuilder(ALT_ATTR), new ImmutablePair(PASSED, ""), new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_NOT_EMPTY_ALT_MSG), ALT_ATTR, TITLE_ATTR), // Checker sur la présence de l'attribut title
        new AttributePresenceChecker(TITLE_ATTR, new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_TITLE_ATTR_MSG), new ImmutablePair(PASSED, ""), TITLE_ATTR), // checker sur la présence de l'attribut aria-label
        new AttributePresenceChecker(ARIA_LABEL_ATTR, new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_ARIA_LABEL_ATTR_MSG), new ImmutablePair(PASSED, ""), ARIA_LABEL_ATTR), // checker sur la présence de l'attribut aria-labelledby
        new AttributePresenceChecker(ARIA_LABELLEDBY_ATTR, new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_ARIA_LABELLEDBY_ATTR_MSG), new ImmutablePair(PASSED, ""), ARIA_LABELLEDBY_ATTR), // checker sur la présence de l'attribut aria-describedby
        new AttributePresenceChecker(ARIA_DESCRIBEDBY_ATTR, new ImmutablePair(FAILED, DECORATIVE_ELEMENT_WITH_ARIA_DESCRIBEDBY_ATTR_MSG), new ImmutablePair(PASSED, ""), ARIA_DESCRIBEDBY_ATTR));
        ec.setIsOrCombinaison(false);
        return ec;
    }

    /**
     * @return the checker user for not marked elements
     */
    private ElementChecker getLocalRegularElementChecker() {
        CompositeChecker compositeChecker = new CompositeChecker(new TextEmptinessChecker(new TextAttributeOfElementBuilder(ALT_ATTR), new ImmutablePair(PASSED, ""), new ImmutablePair(FAILED, "")), new AttributePresenceChecker(TITLE_ATTR, new ImmutablePair(FAILED, ""), new ImmutablePair(PASSED, "")));
        compositeChecker.setIsOrCombinaison(false);
        compositeChecker.addCheckMessageFromSolution(PASSED, Collections.singletonMap(NEED_MORE_INFO, RemarkMessageStore.CHECK_NATURE_OF_IMAGE_WITH_EMPTY_ALT_MSG));
        compositeChecker.addCheckMessageFromSolution(FAILED, Collections.singletonMap(NEED_MORE_INFO, RemarkMessageStore.CHECK_NAT

        return compositeChecker;
    }
}


protected List<String> tabComplete(ISender sender, CommandArguments arguments)

package moe.caa.multilogin.core.command;

import lombok.AccessLevel;
import lombok.Getter;
import moe.caa.multilogin.core.impl.ISender;
import moe.caa.multilogin.core.main.MultiCore;
import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;

@Getter(value = AccessLevel.PROTECTED)
public abstract class BaseCommandExecutor {

    private final MultiCore core;

    private final CommandHandler commandHandler;

    private final String permission;

    private final ConcurrentHashMap<String, BaseCommandExecutor> subCommand = new ConcurrentHashMap<>();

    protected BaseCommandExecutor(MultiCore core, CommandHandler commandHandler, String permission) {
        this.core = core;
        this.commandHandler = commandHandler;
        this.permission = permission;
    }

    /**
     * 执行这条指令
     *
     * @param sender    命令执行者
     * @param arguments 命令参数
     */
    protected CommandResult execute(ISender sender, CommandArguments arguments) throws SQLException, ExecutionException, InterruptedException {
        if (arguments.getLength() != 0) {
            BaseCommandExecutor executor = subCommand.get(arguments.getIndex(0).toLowerCase(Locale.ROOT));
            if (executor != null) {
                if (executor.getPermission() == null || sender.hasPermission(executor.getPermission())) {
                    arguments.offset(1);
                    return executor.execute(sender, arguments);
                }
                return CommandResult.NO_PERMISSION;
            }
        }
        return CommandResult.UNKNOWN_USAGE;
    }

    /**
     * 补全这条指令
     *
     * @param sender    命令执行者
     * @param arguments 命令参数
     */

{
        return Collections.emptyList();
    }
}


{
        return Collections.emptyList();
    }

package moe.caa.multilogin.core.command;

import lombok.AccessLevel;
import lombok.Getter;
import moe.caa.multilogin.core.impl.ISender;
import moe.caa.multilogin.core.main.MultiCore;
import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;

@Getter(value = AccessLevel.PROTECTED)
public abstract class BaseCommandExecutor {

    private final MultiCore core;

    private final CommandHandler commandHandler;

    private final String permission;

    private final ConcurrentHashMap<String, BaseCommandExecutor> subCommand = new ConcurrentHashMap<>();

    protected BaseCommandExecutor(MultiCore core, CommandHandler commandHandler, String permission) {
        this.core = core;
        this.commandHandler = commandHandler;
        this.permission = permission;
    }

    /**
     * 执行这条指令
     *
     * @param sender    命令执行者
     * @param arguments 命令参数
     */
    protected CommandResult execute(ISender sender, CommandArguments arguments) throws SQLException, ExecutionException, InterruptedException {
        if (arguments.getLength() != 0) {
            BaseCommandExecutor executor = subCommand.get(arguments.getIndex(0).toLowerCase(Locale.ROOT));
            if (executor != null) {
                if (executor.getPermission() == null || sender.hasPermission(executor.getPermission())) {
                    arguments.offset(1);
                    return executor.execute(sender, arguments);
                }
                return CommandResult.NO_PERMISSION;
            }
        }
        return CommandResult.UNKNOWN_USAGE;
    }

    /**
     * 补全这条指令
     *
     * @param sender    命令执行者
     * @param arguments 命令参数
     */
    protected List<String> tabComplete(ISender sender, CommandArguments arguments)


package moe.caa.multilogin.core.command;

import lombok.AccessLevel;
import lombok.Getter;
import moe.caa.multilogin.core.impl.ISender;
import moe.caa.multilogin.core.main.MultiCore;
import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;

@Getter(value = AccessLevel.PROTECTED)
public abstract class BaseCommandExecutor {

    private final MultiCore core;

    private final CommandHandler commandHandler;

    private final String permission;

    private final ConcurrentHashMap<String, BaseCommandExecutor> subCommand = new ConcurrentHashMap<>();

    protected BaseCommandExecutor(MultiCore core, CommandHandler commandHandler, String permission) {
        this.core = core;
        this.commandHandler = commandHandler;
        this.permission = permission;
    }

    /**
     * 执行这条指令
     *
     * @param sender    命令执行者
     * @param arguments 命令参数
     */
    protected CommandResult execute(ISender sender, CommandArguments arguments) throws SQLException, ExecutionException, InterruptedException {
        if (arguments.getLength() != 0) {
            BaseCommandExecutor executor = subCommand.get(arguments.getIndex(0).toLowerCase(Locale.ROOT));
            if (executor != null) {
                if (executor.getPermission() == null || sender.hasPermission(executor.getPermission())) {
                    arguments.offset(1);
                    return executor.execute(sender, arguments);
                }
                return CommandResult.NO_PERMISSION;
            }
        }
        return Comma

    }

    /**
     * 补全这条指令
     *
     * @param sender    命令执行者
     * @param arguments 命令参数
     */
    protected List<String> tabComplete(ISender sender, CommandArguments arguments) {
        return Collections.emptyList();
    }
}


protected List<String> tabComplete(ISender sender, CommandArguments arguments) {
        return Collections.emptyList();
    }


package com.alrubaye.alaram;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import java.util.Calendar;

/**
 * Created by hussienalrubaye on 11/1/16.
 */
public class savedata {

    SharedPreferences ShredRef;

    Context context;

    public savedata(Context context) {
        this.context = context;
        ShredRef = context.getSharedPreferences("myRef", Context.MODE_PRIVATE);
    }

    public void SaveData(int hour, int minute) {
        SharedPreferences.Editor editor = ShredRef.edit();
        editor.putInt("hour", hour);
        editor.putInt("minute", minute);
        editor.commit();
    }

{
        int Minute = ShredRef.getInt("minute", 0);
        int Hour = ShredRef.getInt("hour", 0);
        Alarmset(Hour, Minute);
    }

    void Alarmset(int Hour, int Minute) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.HOUR_OF_DAY, Hour);
        calendar.set(Calendar.MINUTE, Minute);
        calendar.set(Calendar.SECOND, 0);
        AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        Intent intent = new Intent(context, MyReceiver.class);
        intent.setAction("com.alraby.alam");
        intent.putExtra("MyMessage", "hello from alarm");
        PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi);
    }
}


{
        SharedPreferences.Editor editor = ShredRef.edit();
        editor.putInt("hour", hour);
        editor.putInt("minute", minute);
        editor.commit();
    }

package com.alrubaye.alaram;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import java.util.Calendar;

/**
 * Created by hussienalrubaye on 11/1/16.
 */
public class savedata {

    SharedPreferences ShredRef;

    Context context;

    public savedata(Context context) {
        this.context = context;
        ShredRef = context.getSharedPreferences("myRef", Context.MODE_PRIVATE);
    }

    public void SaveData(int hour, int minute)

    public void LoadData() {
        int Minute = ShredRef.getInt("minute", 0);
        int Hour = ShredRef.getInt("hour", 0);
        Alarmset(Hour, Minute);
    }

    void Alarmset(int Hour, int Minute) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.HOUR_OF_DAY, Hour);
        calendar.set(Calendar.MINUTE, Minute);
        calendar.set(Calendar.SECOND, 0);
        AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        Intent intent = new Intent(context, MyReceiver.class);
        intent.setAction("com.alraby.alam");
        intent.putExtra("MyMessage", "hello from alarm");
        PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi);
    }
}


package com.alrubaye.alaram;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import java.util.Calendar;

/**
 * Created by hussienalrubaye on 11/1/16.
 */
public class savedata {

    SharedPreferences ShredRef;

    Context context;

    public savedata(Context context) {
        this.context = context;
        ShredRef = context.getSharedPreferences("myRef", Context.MODE_PRIVATE);
    }

    public void SaveData(int hour, int minute) {
        SharedPreferences.Editor editor = ShredRef.edit();
        editor.putInt("hour", hour);
        editor.putInt("minute", minute);
        editor.commit();
    }

    public void LoadData() {
        int Minute = ShredRef.getInt("minute", 0);
        int Hour = ShredRef.getInt("hour", 0);
        A

    }

    void Alarmset(int Hour, int Minute) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.HOUR_OF_DAY, Hour);
        calendar.set(Calendar.MINUTE, Minute);
        calendar.set(Calendar.SECOND, 0);
        AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        Intent intent = new Intent(context, MyReceiver.class);
        intent.setAction("com.alraby.alam");
        intent.putExtra("MyMessage", "hello from alarm");
        PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi);
    }
}


package org.robotframework.red.nattable.configs;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.assertj.core.api.Condition;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Display;
import org.junit.jupiter.api.Test;
import org.robotframework.ide.eclipse.main.plugin.tableeditor.TableThemes.TableTheme;
import org.robotframework.red.graphics.ColorsManager;
import org.robotframework.red.nattable.painter.UnderlinedCellBackgroundPainter;

public class RowHeaderStyleConfigurationTest {

    @Test
    public void configurationCheck() {
        final Font fontInUse = Display.getCurrent().getSystemFont();
        final Color bgColorInUse = ColorsManager.getColor(200, 200, 200);
        final Color fgColorInUse = ColorsManager.getColor(100, 100, 100);
        final TableTheme theme = mock(TableTheme.class);
        when(theme.getFont()).thenReturn(fontInUse);
        when(theme.getHeadersBackground()).thenReturn(bgColorInUse);
        when(theme.getHeadersForeground()).thenReturn(fgColorInUse);
        when(theme.getHeadersUnderlineColor()).thenReturn(ColorsManager.getColor(200, 0, 0));
        final RowHeaderStyleConfiguration configuration = new RowHeaderStyleConfiguration(theme);
        assertThat(configuration).has(font(fontInUse));
        assertThat(configuration).has(background(bgColorInUse));
        assertThat(configuration).has(foreground(fgColorInUse));
        assertThat(configuration.cellPainter).isInstanceOf(UnderlinedCellBackgroundPainter.class);
    }

    private Condition<RowHeaderStyleConfiguration> background(final Color bgColorInUse) {
        return new Condition<RowHeaderStyleConfiguration>() {

{
                return config.bgColor.equals(bgColorInUse);
            }
        };
    }

    private Condition<RowHeaderStyleConfiguration> foreground(final Color fgColorInUse) {
        return new Condition<RowHeaderStyleConfiguration>() {

            @Override
            public boolean matches(final RowHeaderStyleConfiguration config) {
                return config.fgColor.equals(fgColorInUse);
            }
        };
    }

    private static Condition<RowHeaderStyleConfiguration> font(final Font font) {
        return new Condition<RowHeaderStyleConfiguration>() {

            @Override
            public boolean matches(final RowHeaderStyleConfiguration config) {
                return config.font.equals(font);
            }
        };
    }
}


{
        return new Condition<RowHeaderStyleConfiguration>() {

            @Override
            public boolean matches(final RowHeaderStyleConfiguration config) {
                return config.font.equals(font);
            }
        };
    }

package org.robotframework.red.nattable.configs;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.assertj.core.api.Condition;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Display;
import org.junit.jupiter.api.Test;
import org.robotframework.ide.eclipse.main.plugin.tableeditor.TableThemes.TableTheme;
import org.robotframework.red.graphics.ColorsManager;
import org.robotframework.red.nattable.painter.UnderlinedCellBackgroundPainter;

public class RowHeaderStyleConfigurationTest {

    @Test
    public void configurationCheck() {
        final Font fontInUse = Display.getCurrent().getSystemFont();
        final Color bgColorInUse = ColorsManager.getColor(200, 200, 200);
        final Color fgColorInUse = ColorsManager.getColor(100, 100, 100);
        final TableTheme theme = mock(TableTheme.class);
        when(theme.getFont()).thenReturn(fontInUse);
        when(theme.getHeadersBackground()).thenReturn(bgColorInUse);
        when(theme.getHeadersForeground()).thenReturn(fgColorInUse);
        when(theme.getHeadersUnderlineColor()).thenReturn(ColorsManager.getColor(200, 0, 0));
        final RowHeaderStyleConfiguration configuration = new RowHeaderStyleConfiguration(theme);
        assertThat(configuration).has(font(fontInUse));
        assertThat(configuration).has(background(bgColorInUse));
        assertThat(configuration).has(foreground(fgColorInUse));
        assertThat(configuration.cellPainter).isInstanceOf(UnderlinedCellBackgroundPainter.class);
    }

    private Condition<RowHeaderStyleConfiguration> background(final Color bgColorInUse) {
        return new Condition<RowHeaderStyleConfiguration>() {

            @Override
            public boolean matches(final RowHeaderStyleConfiguration config) {
                return config.bgColor.equals(bgColorInUse);
            }
        };
    }

    private Condition<RowHeaderStyleConfiguration> foreground(final Color fgColorInUse) {
        return new Condition<RowHeaderStyleConfiguration>() {

            @Override
            public boolean matches(final RowHeaderStyleConfiguration config) {
                return config.fgColor.equals(fgColorInUse);
            }
        };
    }

    private static Condition<RowHeaderStyleConfiguration> font(final Font font)


package org.robotframework.red.nattable.configs;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.assertj.core.api.Condition;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Display;
import org.junit.jupiter.api.Test;
import org.robotframework.ide.eclipse.main.plugin.tableeditor.TableThemes.TableTheme;
import org.robotframework.red.graphics.ColorsManager;
import org.robotframework.red.nattable.painter.UnderlinedCellBackgroundPainter;

public class RowHeaderStyleConfigurationTest {

    @Test
    public void configurationCheck() {
        final Font fontInUse = Display.getCurrent().getSystemFont();
        final Color bgColorInUse = ColorsManager.getColor(200, 200, 200);
        final Color fgColorInUse = ColorsManager.getColor(100, 100, 100);
        final TableTheme theme = mock(TableTheme.class);
        when(theme.getFont()).thenReturn(fontInUse);
        when(theme.getHeadersBackground()).thenReturn(bgColorInUse);
        when

        when(theme.getHeadersUnderlineColor()).thenReturn(ColorsManager.getColor(200, 0, 0));
        final RowHeaderStyleConfiguration configuration = new RowHeaderStyleConfiguration(theme);
        assertThat(configuration).has(font(fontInUse));
        assertThat(configuration).has(background(bgColorInUse));
        assertThat(configuration).has(foreground(fgColorInUse));
        assertThat(configuration.cellPainter).isInstanceOf(UnderlinedCellBackgroundPainter.class);
    }

    private Condition<RowHeaderStyleConfiguration> background(final Color bgColorInUse) {
        return new Condition<RowHeaderStyleConfiguration>() {

            @Override
            public boolean matches(final RowHeaderStyleConfiguration config) {
                return config.bgColor.equals(bgColorInUse);
            }
        };
    }

    private Condition<RowHeaderStyleConfiguration> foreground(final Color fgColorInUse) {
        return new Condition<RowHeaderStyleConfiguration>() {

            @Override
            public boolean matches(final RowHeaderStyleConfiguration config) {
                return config.fgColor.equals(fgColorInUse);
            }
        };
    }

    private static Condition<RowHeaderStyleConfiguration> font(final Font font) {
        return new Condition<RowHeaderStyleConfiguration>() {

            @Override
            public boolean matches(final RowHeaderStyleConfiguration config) {
                return config.font.equals(font);
            }
        };
    }
}


public final String getServiceDescription()

package com.onelogin.saml2.model;

import java.util.ArrayList;
import java.util.List;
import com.onelogin.saml2.model.RequestedAttribute;

/**
 * AttributeConsumingService class of OneLogin's Java Toolkit.
 *
 * A class that stores AttributeConsumingService
 */
public class AttributeConsumingService {

    /**
     * Service Name
     */
    private final String serviceName;

    /**
     * Service Description
     */
    private final String serviceDescription;

    /**
     * Requested Attributes
     */
    private final List<RequestedAttribute> requestedAttributes;

    /**
     * Constructor
     *
     * @param serviceName
     *              String. Service Name
     * @param serviceDescription
     *              String. Service Description
     */
    public AttributeConsumingService(String serviceName, String serviceDescription) {
        this.serviceName = serviceName != null ? serviceName : "";
        this.serviceDescription = serviceDescription != null ? serviceDescription : "";
        this.requestedAttributes = new ArrayList<RequestedAttribute>();
    }

    /**
     * @param attr
     *              RequestedAttribute. The requested attribute to be included
     */
    public final void addRequestedAttribute(RequestedAttribute attr) {
        this.requestedAttributes.add(attr);
    }

    /**
     * @return string the service name
     */
    public final String getServiceName() {
        return serviceName;
    }

    /**
     * @return string the service description
     */

{
        return serviceDescription;
    }

    /**
     * @return List the requested attributes
     */
    public final List<RequestedAttribute> getRequestedAttributes() {
        return requestedAttributes;
    }
}


{
        return serviceDescription;
    }

package com.onelogin.saml2.model;

import java.util.ArrayList;
import java.util.List;
import com.onelogin.saml2.model.RequestedAttribute;

/**
 * AttributeConsumingService class of OneLogin's Java Toolkit.
 *
 * A class that stores AttributeConsumingService
 */
public class AttributeConsumingService {

    /**
     * Service Name
     */
    private final String serviceName;

    /**
     * Service Description
     */
    private final String serviceDescription;

    /**
     * Requested Attributes
     */
    private final List<RequestedAttribute> requestedAttributes;

    /**
     * Constructor
     *
     * @param serviceName
     *              String. Service Name
     * @param serviceDescription
     *              String. Service Description
     */
    public AttributeConsumingService(String serviceName, String serviceDescription) {
        this.serviceName = serviceName != null ? serviceName : "";
        this.serviceDescription = serviceDescription != null ? serviceDescription : "";
        this.requestedAttributes = new ArrayList<RequestedAttribute>();
    }

    /**
     * @param attr
     *              RequestedAttribute. The requested attribute to be included
     */
    public final void addRequestedAttribute(RequestedAttribute attr) {
        this.requestedAttributes.add(attr);
    }

    /**
     * @return string the service name
     */
    public final String getServiceName() {
        return serviceName;
    }

    /**
     * @return string the service description
     */
    public final String getServiceDescription()

    /**
     * @return List the requested attributes
     */
    public final List<RequestedAttribute> getRequestedAttributes() {
        return requestedAttributes;
    }
}


package com.onelogin.saml2.model;

import java.util.ArrayList;
import java.util.List;
import com.onelogin.saml2.model.RequestedAttribute;

/**
 * AttributeConsumingService class of OneLogin's Java Toolkit.
 *
 * A class that stores AttributeConsumingService
 */
public class AttributeConsumingService {

    /**
     * Service Name
     */
    private final String serviceName;

    /**
     * Service Description
     */
    private final String serviceDescription;

    /**
     * Requested Attributes
     */
    private final List<RequestedAttribute> requestedAttributes;

    /**
     * Constructor
     *
     * @param serviceName
     *              String. Service Name
     * @param serviceDescription
     *              String. Service Description
     */
    public AttributeConsumingService(String serviceName, String serviceDescription) {
        this.serviceName = serviceName != null ? serviceName : "";
        this.serviceDescription = serviceDescription != null ? serviceDescription : "";
        this.requestedAttributes = new ArrayList<RequestedAttribute>();
    }

    /**
     * @param attr
     *              RequestedAttribute. The requested attribute to be included
     */
    public final void addRequestedAttribute(RequestedAttribute attr) {
        this.requestedAttributes.add(attr);
    }

    /**
     * @return string the service name
     */
    public final String getServiceName() {
        return serviceName;
    }

    /**
     * @return string the service description
     */
    public final String getServiceDescription() {
        return serviceDescription;
    }

    /**
     * @return List the requested attributes
     */
    public final List<RequestedAttribute> getRequestedAttributes() {
        return requestedAttrib


public final List<RequestedAttribute> getRequestedAttributes() {
        return requestedAttributes;
    }

package com.onelogin.saml2.model;

import java.util.ArrayList;
import java.util.List;
import com.onelogin.saml2.model.RequestedAttribute;

/**
 * AttributeConsumingService class of OneLogin's Java Toolkit.
 *
 * A class that stores AttributeConsumingService
 */
public class AttributeConsumingService {

    /**
     * Service Name
     */
    private final String serviceName;

    /**
     * Service Description
     */
    private final String serviceDescription;

    /**
     * Requested Attributes
     */
    private final List<RequestedAttribute> requestedAttributes;

    /**
     * Constructor
     *
     * @param serviceName
     *              String. Service Name
     * @param serviceDescription
     *              String. Service Description
     */
    public AttributeConsumingService(String serviceName, String serviceDescription) {
        this.serviceName = serviceName != null ? serviceName : "";
        this.serviceDescription = serviceDescription != null ? serviceDescription : "";
        this.requestedAttributes = new ArrayList<RequestedAttribute>();
    }

    /**
     * @param attr
     *              RequestedAttribute. The requested attribute to be included
     */
    public final void addRequestedAttribute(RequestedAttribute attr) {
        this.requestedAttributes.add(attr);
    }

    /**
     * @return string the service name
     */
    public final String getServiceName() {
        return serviceName;
    }

    /**
     * @return string the service description
     */
    public final String getServiceDescription() {
        return serviceDescription;
    }

    /**
     * @return List the requested attributes
     */


package com.zyd.blog.util;

import com.zyd.blog.framework.holder.RequestHolder;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

/**
 * @author yadong.zhang (yadong.zhang0415(a)gmail.com)
 * @version 1.0
 * @website https://docs.zhyd.me
 * @date 2018/4/18 11:48
 * @since 1.0
 */
public class RequestUtil {

    public static String getParameters() {
        HttpServletRequest request = RequestHolder.getRequest();
        if (null == request) {
            return null;
        }
        Enumeration<String> paraNames = request.getParameterNames();
        if (paraNames == null) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        while (paraNames.hasMoreElements()) {
            String paraName = paraNames.nextElement();
            sb.append("&").append(paraName).append("=").append(request.getParameter(paraName));
        }
        return sb.toString();
    }

    public static Map<String, String[]> getParametersMap() {
        HttpServletRequest request = RequestHolder.getRequest();
        if (null == request) {
            return new HashMap<>();
        }
        return request.getParameterMap();
    }

    public static String getHeader(String headerName) {
        HttpServletRequest request = RequestHolder.getRequest();
        if (null == request) {
            return null;
        }
        return request.getHeader(headerName);
    }

    public static String getReferer() {
        return getHeader("Referer");
    }

{
        return getHeader("User-Agent");
    }

    public static String getIp() {
        HttpServletRequest request = RequestHolder.getRequest();
        if (null == request) {
            return null;
        }
        return IpUtil.getRealIp(request);
    }

    public static String getRequestUrl() {
        HttpServletRequest request = RequestHolder.getRequest();
        if (null == request) {
            return null;
        }
        return request.getRequestURL().toString();
    }

    public static String getMethod() {
        HttpServletRequest request = RequestHolder.getRequest();
        if (null == request) {
            return null;
        }
        return request.getMethod();
    }

    public static boolean isAjax(HttpServletRequest request) {
        if (null == request) {
            request = RequestHolder.getRequest();
        }
        if (null == request) {
            return false;
        }
        return "XMLHttpRequest".equalsIgnoreCase(request.getHeader("X-Requested-With")) || request.getParameter("ajax") != null;
    }
}