text stringlengths 14 410k | label int32 0 9 |
|---|---|
public DarkIRCBot() {
Properties prop = new Properties();
InputStream input = null;
try {
input = new FileInputStream(DarkIRCmain.getConfigFile());
// load a properties file
prop.load(input);
... | 4 |
@Override
protected void onKick(String channel, String kickerNick, String kickerLogin,
String kickerHostname, String recipientNick, String reason) {
ChannelEventsListener listener = getChannelEventsListener(channel);
if (listener != null)
listener.userKicked(kic... | 1 |
public boolean Login() throws LoginFailException {
try {
String url_id = URLEncoder.encode(id, "UTF-8");
String url_pw = URLEncoder.encode(pw, "UTF-8");
String url = "https://www.melon.com/muid/login/web/login_informProcs.htm";
String param = "memberId=" + url_id ... | 4 |
private boolean indexOK(int index) {
return (index >= 0 && index < array.length);
} | 1 |
public SnmpPdu decodePDU(BerDecoder raw_packet)
throws SnmpMessageException, BerException {
SnmpPdu pdu = new SnmpPdu();
int length;
pdu.setPduType(raw_packet.decodeTag(-1));
if (debug) dump(pdu.pduTypeToString());
switch (pdu.getPduType()... | 9 |
public List<Account> findDeliquentAccounts() throws Exception {
ArrayList<Account> delinquentAccounts = new ArrayList<>();
List<Account> accounts = jdbcAccountDao.findAllAccounts();
Date thirtyDaysAgo = daysAgo(30);
for (Account account : accounts) {
boolean owesMoney = acco... | 3 |
public void addToStart(String value) {
ListElement current = new ListElement(value);
if (count == 0) {
head = current;
tail = current;
} else {
current.connectNext(head);
head = current;
}
count++;
} | 1 |
public static void main(String[] args) {
if (args.length != 5){
System.err.println("Incorrect number of arguments");
System.err.println("Syntax: java AllAssignmentsGrader " +
"<hw1|hw2|...> " +
"<gradesource_students_file> <ACMS_accounts_file> " +
"<test_cases_file> <directory_of_submission... | 9 |
public void sendBroadcast (Message message)
{
try
{
switch (message.getType())
{
// Etat 10 : On envoi un message en broadcast
case 10 :
{
// On cree une copie pour nous meme
program.getChat().getBroadcast().addMessage(message);
break;
}
// Etat 11 : On envoi un fichie... | 6 |
public boolean parsePublicMessage(String message, Client client) {
if (status > 2 && !client.isModerator()) {
client.sendButlerMessage(channel.getName(),
"In diesem Channel kannst du nicht öffentlich sprechen.");
return false;
}
String msg = message.toLowerCase();
if (msg.contains(Server.get().getB... | 6 |
@Test
/**
* This does not test the distribution, but if we belive in the random generators
* it tests the "border values" in that all possible values must be generated
*/
public void testGetRandomQuestion()
{
int testTries = 30;
boolean horseFound = false;
boolean houseFound = false;
bool... | 6 |
public void setTotal(int total) {
this.total = total;
int pages = total / size;
boolean hasMore = (0 != total % size);
if (0 == pages) {
totalPage = 1;
} else {
if (hasMore) {
totalPage = pages + 1;
} else {
totalPage = pages;
}
}
if (curpage > totalPage) {
curpage = totalPage;
}
... | 4 |
public void setEqualizer(Equalizer eq)
{
if (eq==null)
eq = Equalizer.PASS_THRU_EQ;
equalizer.setFrom(eq);
float[] factors = equalizer.getBandFactors();
if (filter1!=null)
filter1.setEQ(factors);
if (filter2!=null)
filter2.setEQ(factors);
} | 3 |
private static void getCommand() {
System.out.print("[Moves:" + moves + " Score:" + score + " Ratio:" + ratio + " Possible directions:" + possibleDirs + "] ");
Scanner inputReader = new Scanner(System.in);
command = inputReader.nextLine();
} | 0 |
* @param body
* @return Stella_Object
*/
public static Stella_Object traceIf(Stella_Object keyword, Cons body) {
{ Cons test = Stella.NIL;
Cons elements = Cons.copyConsList(body);
if (Stella_Object.safePrimaryType(keyword) == Stella.SGT_STELLA_CONS) {
{ Cons keyword000 = ((Cons)(keyword... | 9 |
public void InitMouseListener(){
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
setSelected(true);
}
@Override
public void mousePressed(MouseEvent arg0) {
... | 5 |
@SuppressWarnings("serial")
public JTableRenderer(final Object cell,
final mxGraphComponent graphContainer)
{
this.cell = cell;
this.graphContainer = graphContainer;
this.graph = graphContainer.getGraph();
setLayout(new BorderLayout());
setBorder(BorderFactory.createCompoundBorder(ShadowBorder
.getSh... | 2 |
@Override
public void apply(View view, Changes changes)
{
byte[] colors = new byte[(((rad2 * 2) + 1) * ((rad2 * 2) + 1)) - 1];
for(int x = -rad; x <= rad; ++ x)
{
for(int y = -rad; y <= rad; ++ y)
{
int index = 0;
for(int x2 = -rad2; x2 <= rad2; ++ x2)
{
for(int y2 = -rad2; y2 <= ... | 6 |
public void avancer() {
switch (position.getDirection()) {
case N:
if (position.getY() < gridMaximumValueY)
position.setY(position.getY() + 1);
break;
case E:
if (position.getX() < gridMaximumValueX)
position.setX(position.getX() + 1);
break;
case W:
if (position.getX() > 0)
... | 8 |
public static void main(String argv[]){
File fullfolder = new File("/home/dharmesh/aditya/author_profiling/pan_author_profiling_training_data/enoutput/");
File trainfolder = new File("/home/dharmesh/aditya/author_profiling/pan_author_profiling_training_data/entraining/");
File testfolder = new File("/home/dharmes... | 6 |
private void SearchList(String s) {
DefaultListModel<Item> listModel = new DefaultListModel<Item>();
ArrayList<Item> items = (ArrayList<Item>) Main.getItemList();
for (Item item : items) {
if (item.getName().startsWith(s)
|| item.getName().contains(" " + s))
listModel.addElement(item);
}
if (list ... | 4 |
public static LogicObject dowKeywordToInstance(Keyword dow) {
if (dow == Timepoint.KWD_MONDAY) {
return (((LogicObject)(Timepoint.SGT_TIMEPOINT_KB_MONDAY.surrogateValue)));
}
else if (dow == Timepoint.KWD_TUESDAY) {
return (((LogicObject)(Timepoint.SGT_TIMEPOINT_KB_TUESDAY.surrogateValue)));
... | 7 |
@Override
public V put(K key, V value) {
V oldValue = null;
int index = Math.abs(key.hashCode()) % SIZE;
if(buckets[index] == null) {
buckets[index] = new LinkedList<MapEntry<K, V>>();
}
LinkedList<MapEntry<K, V>> bucket = buckets[index];
MapEntry<K, V> ... | 5 |
@Override
public void run() {
int answer = 0;
Set<Integer> answers = new HashSet<>();
for(int i = 1; i < 9999; i++) {
if(i % 10 == 0)
continue;
for(int j = 1; j < 999; j++) {
if(j % 10 == 0)
continue;
int sum = i * j;
if(sum > 987654321)
break;
if(verify(i, j, sum)) {
ans... | 7 |
private void makeLanguages(String str){
int end = 0;
while(end >= 0 && str != null){
end = str.indexOf("*, ");
if(end >= 0){
String tmp = str.substring(0, end);
int index = 0;
while(index >= 0){
index = tmp.indexOf(", ");
if(index >= 0){
languages.add(tmp.substring(0, index));
... | 9 |
public void setDoubleOptin(boolean doubleOptin) {
this.doubleOptin = doubleOptin;
} | 0 |
public synchronized char getItemType(Position position){
if (field[position.getX()][position.getY()] != null) return field[position.getX()][position.getY()].getType();
return 0;
} | 1 |
public static Iterator allDirectSubcollections(LogicObject self, boolean performfilteringP) {
if (Stella_Object.isaP(self, Logic.SGT_LOGIC_DESCRIPTION)) {
Description.deriveDeferredSatelliteRules(((Description)(self)));
}
{ Iterator directlylinkedobjects = Logic.allDirectlyLinkedObjects(self, Logic.SG... | 7 |
@Override
public void actionPerformed(ActionEvent event) {
JButton selection = (JButton) (event.getSource());
if (selection.equals(craps)) {
new Craps(money, name);
this.dispose();
}
if (selection.equals(blackjack)) {
new Blackjack(money, name);
this.dispose();
}
if (selection.equals(slots)) {
... | 6 |
@Override
public Message toMessage(Session session) throws JMSException {
Message message = session.createMessage();
setMessageProperties(message);
message.setJMSType(TYPE);
return message;
} | 0 |
@Override
public Protein getProteinFromFile(File f)
{
Protein protein = new Protein();
try
{
BufferedReader br = new BufferedReader(new FileReader(f));
try
{
String line = br.readLine();
int start = line.indexOf(QUOTE, NAME_QUO... | 7 |
public void setLogFileMessageFormatter(LogFileMessageFormatter msgFormatter) {this.msgFormatter = msgFormatter;} | 0 |
public static void loadConfig(String filename) {
try {
Reader read = null;
read = new FileReader(new File(filename));
JSONTokener jsonReader = new JSONTokener(read);
JSONObject params = new JSONObject(jsonReader);
/*
* Reading in configuration information from the file, things like confidence, merg... | 8 |
public void setValueAt(Object value, int row, int column) {
switch (column) {
case 0:
variables[row] = (String) value;
break;
case 1:
firstSets[row] = removeDuplicateCharacters((String) value);
break;
case 2:
followSets[row] = removeDuplicateCharacters((String) value);
break;
}
} | 3 |
public void processCookies(MimeHeaders headers) {
if (headers == null)
return;// nothing to process
// process each "cookie" header
int pos = 0;
while (pos >= 0) {
// Cookie2: version ? not needed
pos = headers.findHeader("Cookie", pos);
// no more cookie headers headers
if (pos < 0)
break;
... | 7 |
public void addHurdle(Hurdle hurdle) {
hurdleList.add(hurdle);
} | 0 |
public int subtraction() {
if (stack.stackLength() > 1) {
int firstNum = stack.top();
stack.pop();
int secondNum = stack.top();
stack.pop();
return firstNum - secondNum;
} else {
return error;
}
} | 1 |
public void actionPerformed(ActionEvent event) {
if(event.getSource().equals(close)) {
this.setVisible(false);
} else if(event.getSource().equals(versionTest)) {
VersionTester.testVersion(false, true);
} else if(event.getSource().equals(testForUpdatesAtStartup)) {
AppConfig.getAppConfig().checkForSinalg... | 3 |
public void open() {
shell = new Shell(SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM );
//shell.setImage(RepDevMain.xxxxx);
FormLayout layout = new FormLayout();
layout.marginTop = 10;
layout.marginBottom = 10;
layout.marginLeft = 10;
layout.marginRight = 10;
layout.spacing = 8;
shell.setLayout(layout);... | 8 |
private File getConfigFile(String file)
{
if (file.isEmpty() || file == null) {
return null;
}
File configFile;
if (file.contains("/"))
{
if (file.startsWith("/"))
{
configFile = new File(plugin.getDataFolder() + file.replace("/", File.separator));
} else
{
configFile = new Fil... | 4 |
public double partialContains(Instance instance) throws Exception {
int count = 0;
for (int i = 0; i < instance.numAttributes(); i++) {
if (i == m_ClassIndex) {
continue;
}
if (instance.isMissing(i)) {
continue;
}
double current = instance.value(i);
if (m_NumericBounds[i] != null) { //... | 7 |
public boolean isColliding(Rectangle rect, TileType type) {
for (int i = 0; i < tileList.size(); i++) {
if (type == tileList.get(i).getType()) {
if (rect.intersects(tileList.get(i).getRect())) {
return true;
}
}
}
return false;
} | 3 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Skills)) {
return false;
}
Skills other = (Skills) object;
if ((this.skillsId == null && other.skillsId != null... | 5 |
private void addChromosome(Chromosome chromosome) {
population.add(chromosome);
} | 0 |
private void byteLoop(RasterAccessor src, RasterAccessor dst) {
int dwidth = dst.getWidth();
int dheight = dst.getHeight();
int dnumBands = dst.getNumBands();
int dstBandOffsets[] = dst.getBandOffsets();
int dstPixelStride = dst.getPixelStride();
int dstScanl... | 9 |
@Test
public void removeActivityTest() throws InstanceNotFoundException {
Activity activity = null;
try {
activity = activityService.find(0);
} catch (InstanceNotFoundException e1) {
fail("Activity not exist");
}
activityService.remove(activity);
assertFalse("Activity not delete", activityService.g... | 1 |
@Override
public List<Integer> sort(List<Integer> list) {
// checking input parameter for null
if (list == null) {
throw new IllegalArgumentException("ArrayList not specified!");
}
// moving forward through array
for (int i = 0; i < list.size() - 1; i++) {
... | 4 |
public void updateSubTypes() {
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
GlobalOptions.err.println("setType of " + local.getName() + ": "
+ local.getType());
local.setType(type);
} | 1 |
public void searchForPath() {
setDrawGraphInstance();
if(nodeFromKDV == -1 || nodeToKDV == -1) {
if(!pa.getMalformed()) {
JOptionPane.showMessageDialog(null, "One of the addresses could not be found", "Warning Message", JOptionPane.WARNING_MESSAGE);
}
return;
}
edgesOnPath.clear();
Iterable<MyE... | 5 |
private double[] getSeedFreq(String hash) {
String hashtag;
boolean inBase = false;
//check whether hashtag is baseline criteria
for(String basehash:Settings.baseKeywords){
if(hash.replace("#", "").equals(basehash.toLowerCase()) || hash.equals(basehash)){
inBase = true;
//System.out.println(hash+"... | 7 |
private void winTrick() {
// Examine cardsPlayed pile and determine which player won the trick.
int winnerIndex = determineWinner();
// Change firstToPlay to be the index of the player who won the trick.
this.firstToPlayIndex = winnerIndex;
// Show each player who won the trick and which cards were play... | 2 |
public void update()
{
bg.update(heart.currentHappinessLevel);
heart.update();
for(int i=0; i<stars.size(); i++)
{
stars.get(i).update();
if(stars.get(i).xPos < 0)
{
stars.remove(i);
}
}
if (spaceCount > 5)
{
checkpoint1 = false;
checkpoint2 = true;
}
if (gsm.score > 2... | 5 |
private void setEntityRelevant(String clientId, EntityRef entityRef, boolean relevant) {
if (relevant) {
if (relevantEntities.add(entityRef)) {
for (ClientEntityRelevancyRuleListener listener : listeners) {
listener.entityRelevancyChanged(clientId,... | 5 |
public void setPrintStream(PrintStream printStream) throws IllegalArgumentException{
if(printStream == null)
throw new IllegalArgumentException( "Print stream can not ben null." );
this.printStream = printStream;
} | 1 |
public static void testFindAlgorithm(int[] ns, float[] ks, Random source, int repeatFactor, float myFactor){
Callback cb = new Collector();
Callback comp = new Collector();
RandomizedAlgorithm rand = new FindAlgorithm();
rand.setRandomSource(source);
for(int n : ns){
... | 4 |
void setModelClickability() {
Bond[] bonds = frame.bonds;
for (int i = frame.bondCount; --i >= 0;) {
Bond bond = bonds[i];
if (bond == null || bond.atom1 == null || bond.atom2 == null)
continue;
if ((bond.shapeVisibilityFlags & myVisibilityFlag) == 0 || frame.bsHidden.get(bond.atom1.atomIndex)
|| ... | 7 |
private float[] simulateBowl(float[] currentFruits) {
float[] bowl = new float[NUM_FRUIT_TYPES];
int sz = 0;
while (sz < numFruitsPerBowl) {
// pick a fruit according to current fruit distribution
int fruit = pickFruit(currentFruits);
float c = 1 + random.nextInt(3);
c = Math.min(c,... | 1 |
private static int doEvents( int firedEvents, long startTime )
{
Iterator< Event > it = events.iterator(); // get the iterator for the untimed events
while ( it.hasNext() )
{
if ( TimeHelper.isOver( startTime, MaxTickTime ) )
{
return firedEvents; //... | 5 |
public final boolean process(Player player) {
if (delay > 0) {
delay--;
return true;
}
while (true) {
if (constructingRegion)
return true;
if (stage == actions.length) {
stopCutscene(player);
return false;
} else if (stage == 0)
startCutscene(player);
CutsceneAction action = acti... | 6 |
public void sortLinkedList2() {
long start = System.currentTimeMillis();
Object[] arr= ll.toArray();
Arrays.sort(arr);
ll.clear();
LinkedList<Object> newLL = new LinkedList<>();
for (int i = 0; i < arr.length; i++) {
newLL.add(arr[i]);
}
long end = System.currentTimeMillis();
System.out.println(... | 1 |
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
} | 0 |
public CalRGBColor(PDFObject obj) throws IOException {
// obj is a dictionary that has the following parts:
// WhitePoint [a b c]
// BlackPoint [a b c]
// Gamma a
super(CS_sRGB, 3);
// find out what what is according to the CIE color space
// note that this is not reflexive (i.e. passing t... | 8 |
public static DaoFactory getInstance() {
if(factory == null) {
String classname = PropertyManager.getProperty("persistence.factory");
if (classname != null) try {
factory = (DaoFactory) Class.forName(classname).newInstance();
} catch( Exception e) {
//TODO log this exception with Log4J
System.err... | 4 |
public String toString()
{
StringBuffer res = new StringBuffer("");
String piece = "";
String couleur = "";
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
if(this.tableau[i][j] == null)
{
piece = "Case vide";
couleur = "";
}
else
{
piece = this.tableau[i]... | 3 |
public static String getHexString(byte [] src, int srcPos,int destPos,int length){
byte[] tmp=new byte[length];
System.arraycopy(src, srcPos, tmp, destPos, length);
return (Hex.rhex(tmp));
} | 0 |
* of the <code>Tile</code> for. This object is also used to
* get the <code>ColonyTile</code> for the given <code>Tile</code>.
*/
public void displayColonyTile(Graphics2D g, Tile tile, Colony colony) {
boolean tileCannotBeWorked = false;
Unit occupyingUnit = null;
int pri... | 8 |
public void pickUpItem (int playerID) {
Player p = this.playerIDs.get(playerID);
if (p != null) {
Location l = Location.locationInFrontOf(p.getLocation(), p.getDirection());
InanimateEntity on = board.tileAt(l).getOn();
if (on != null && on instanceof Item) {
if(p.addItemToInventory((Item)on)) {
p... | 5 |
@Override
protected void onDisconnect() {
int reconnectAttempts = 0;
printLog("Connection to " + getServer() + " dropped, "
+ "trying to reconnect...");
// try to reconnect
while(!isConnected() && reconnectAttempts < 15) {
try {
// reconnect
reconnectAttempts++;
reconnect();
} c... | 7 |
protected void resizeArrayToFit(int newCount) {
int steppedSize = buf.length;
if (steppedSize == 0)
steppedSize = 64;
else if (steppedSize <= 1024)
steppedSize *= 4;
else if (steppedSize <= 4024)
steppedSize *= 2;
else if (steppedSize <= 2 * 10... | 6 |
public static double jauDtdb(double date1, double date2,
double ut, double elong, double u, double v)
{
double t, tsol, w, elsun, emsun, d, elj, els, wt, w0, w1, w2, w3, w4,
wf, wj;
int j;
/*
* =====================
* Fairhead et al. model
* =========... | 5 |
@Override
public boolean onKeyDown(int key) {
if(key == Keyboard.KEY_ESCAPE) {
Application.get().getHumanView().popScreen();
return true;
}
return false;
} | 1 |
private void fill(Graphics g, int x, int y, int width, int height, boolean horizontal) {
if (horizontal) {
if (height > block) {
g.setColor(c_bg);
g.fillRect(x, y, width + evm, height - block + evm);
}
for (int i = 0; i < width; i += block) {
g.drawImage(hgradient, x + i, (height > block) ? (y + ... | 7 |
@Override
protected Match addInitialMatch(Edge e, Edge eP, String matchID)
{
Match m = new Match(graph, pattern, e, eP, matchID);
// get neighbor edges in pattern and all matches containing these neighbor edges
Set<Edge> neighborEdgePs = new HashSet<Edge>();
neighborEdgePs.addAll(pattern.getInEdges(eP.getFro... | 7 |
private boolean lukeminenVoidaanAloittaa() {
if (syote == null) {
return false;
}
if (!paikkaSisaltyySyotteeseen()) {
return false;
}
if (paikkaSisaltaaNumeron() || paikkaSisaltaaDesimaalipisteen()) {
return true;
}
... | 4 |
public void requestFocus(short control) {
if (control == ADDNEW && buttonNewTask != null) buttonNewTask.requestFocus();
if (control == PRIORITY) textPriority.requestFocus();
if (control == CONTENT) textContent.requestFocus();
if (control == DATE) textDate.requestFocus();
if (control == COMPLETED) chec... | 7 |
private void addStep(double startPrice, double endPrice, double fixedPrice, double variablePricePercent) {
if (billingServerSecure == null) {
System.out.println("ERROR: You are currently not logged in");
} // Checking for positive interval range
else if (endPrice != 0 && startPrice >= endPrice) {
System.out... | 8 |
private void allocateQueueGridlet()
{
// if there are many Gridlets in the QUEUE, then allocate a
// PE to the first Gridlet in the list since it follows FCFS
// (First Come First Serve) approach. Then removes the Gridlet from
// the Queue list
if (gridletQueueList_.size() > ... | 3 |
public String genFindOrb() {
String nextLine;
URL url;
URLConnection urlConn;
InputStreamReader inStream;
BufferedReader buff;
this.observations = "";
try {
for (NEOCP neocp : neocpData) {
url = new URL(
"http://... | 6 |
private void expParamChanged() {
if (m_Exp == null) return;
if (m_ExperimentTypeCBox.getSelectedItem() == TYPE_CROSSVALIDATION_TEXT) {
try {
m_numFolds = Integer.parseInt(m_ExperimentParameterTField.getText());
} catch (NumberFormatException e) {
return;
}
} else {
try {
m_train... | 7 |
public void move(int xa, int ya) {
if (xa != 0 && ya != 0) {
move(xa, 0);
move(0, ya);
numSteps--;
return;
}
numSteps++;
if (!hasCollided(xa, ya)) {
if (ya < 0)
movingDir = 0;
if (ya > 0)
... | 7 |
@Override
protected void handleProtocol() throws Exception {
handleLoop:
while(!aborted() && !isProtocolCompleted()) {
int timeout = getTimeout();
IPacket packet = socket.waitForPacket(timeout);
if(aborted()) {
return;
}
if(packet == null) {
int newTimeout = getTimeout();
... | 6 |
public synchronized void actualiza(long tiempoTranscurrido){
if (cuadros.size() > 1){
tiempoDeAnimacion += tiempoTranscurrido;
if (tiempoDeAnimacion >= duracionTotal){
tiempoDeAnimacion = tiempoDeAnimacion % duracionTotal;
indiceCuadroActual = 0;
}
while (tiempoDeAnimacion > getCuadro(ind... | 3 |
private static void FFT(){
if (numPoints == 1) return;
final double pi = Math.PI;
final int numStages = (int)(Math.log(numPoints) / Math.log(2));
int halfNumPoints = numPoints >> 1;
int j = halfNumPoints;
// FFT time domain decomposition carried out by ... | 8 |
public void solve()
{
solveStart = System.currentTimeMillis();
// The current state of the solver.
SolverState state = new SolverState();
// Clear solutions
solutions = new ArrayList<State<M>>();
// Clear initial state
initial.setParent( null );
initial.setDepth( 0 );
// Add the initial state... | 3 |
@Override
public int compareTo(Node otherNode) {
float thisTotalDistanceFromGoal = heuristicDistanceFromGoal + distanceFromStart;
float otherTotalDistanceFromGoal = otherNode.getHeuristicDistanceFromGoal() + otherNode.getDistanceFromStart();
if (thisTotalDistanceFromGoal < otherTotalDistanceFromGoal)
return ... | 2 |
private boolean isStart(char c) {
return c == '(' || c == '[' || c == '{';
} | 2 |
public PacketFactory(String ip, int port) {
this.ip = ip;
this.port = port;
} | 0 |
private static boolean handleBishopMove(Board b, ArrayList<Move> moves, Position p, Position currentPosition, int opponentColor) {
if (b.spaceHasOpponent(currentPosition, opponentColor)) {
moves.add(new Move(p, currentPosition));
return false;
} else if (b.spaceIsEmpty(currentPosition)) {
moves.add(new Mov... | 2 |
public BufferedImage[] loadStripImageArray(String fnm, int number)
/*
* Extract the individual images from the strip image file, <fnm>. We assume
* the images are stored in a single row, and that there are <number> of
* them. The images are returned as an array of BufferedImages
*/
{
if (number <= 0) {
S... | 3 |
private void superPlacing(List <Segment> prior) {
final Tile at = origin() ;
super.doPlace(at, at) ;
final Tile o = origin() ;
final World world = o.world ;
for (int i : N_ADJACENT) {
final Tile n = world.tileAt(o.x + (N_X[i] * 2), o.y + (N_Y[i] * 2)) ;
if (n == null) continue ;
... | 6 |
public List<String> getStringList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<String>(0);
}
List<String> result = new ArrayList<String>();
for (Object object : list) {
if ((object instanceof String) || (isPrimit... | 5 |
@EventHandler
private void hit(ProjectileHitEvent evt) {
if (evt.getEntity() instanceof Arrow && ids.contains(evt.getEntity().getEntityId())) {
ids.remove(evt.getEntity().getEntityId());
Location l = evt.getEntity().getLocation();
try {
SpellCraft.fep.playFirework(l.getWorld(), l,
FireworkEffect.b... | 4 |
private void InstanceComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InstanceComboBoxActionPerformed
try {
if (InstanceComboBox.getSelectedItem().toString().equals("<None>")) {
//Display 'no pack selected' content
loadPaneContentFromResource... | 3 |
public static <T extends DC> Similarity getPhiSim(Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>> done)
{ if(done!=null)
{ if(done.getNext()!=null)
{ return new Similarity(done.getFst().fst().fst().delta(done.getFst().snd().fst()).simi().getValue()+(getPhiSim(done.getNext()).getValue()));
}
e... | 2 |
public Options() {
pane = this.getContentPane();
pane.setLayout(null);
this.setTitle(TITLE);
this.setResizable(false);
this.setSize(WIDTH, HEIGHT);
this.setLocationRelativeTo(MainFrame.getThis());
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.setModal(true);
JLabel
them... | 1 |
public void destroy() {
textArea = null;
} | 0 |
public void buildBuilding(Building b, int x, int y) {
if (x >= 0 && y >= 0) {
// check player's gold!
if (buildings[x][y] == null) {
buildings[x][y] = b;
}
} else {
throw new IllegalArgumentException("Field position must be positive");
}
} | 3 |
public void testEmptyClass () {
MethodAccess access = MethodAccess.get(EmptyClass.class);
try {
access.getIndex("name");
fail();
} catch (IllegalArgumentException expected) {
// expected.printStackTrace();
}
try {
access.getIndex("name", String.class);
fail();
} catch (IllegalArgumentExceptio... | 5 |
@SuppressWarnings("deprecation")
private void printStackTraceSync(Throwable t, boolean expected)
{
BukkitScheduler bs = plugin.getServer().getScheduler();
try
{
String prefix = "[AutoUpdate] ";
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
String[... | 7 |
public static int getPortFileTransfer(String inString)
throws JDOMException, IOException, TagFormatException {
SAXBuilder mSAXBuilder = new SAXBuilder();
Document mDocument = mSAXBuilder.build(new StringReader(inString));
Element rootNode = mDocument.getRootElement();
String protType = rootNode.getName();
... | 1 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.