text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void initializeControls(Composite parent) {
setLayout(new GridLayout(3, false));
viewsList = new TabListWidget(this, "Views", views);
viewsList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
if(!views.isEmpty() && !editors.isEmpty()) {
LineWidget line = new LineWidget(this, LineDi... | 2 |
public void setNumero(int num)
{
this.numero = num ;
} | 0 |
public Entity getEntity(int id) {
for (Entity e : entities) {
if (e.getID() == id) {
return e;
}
}
return null;
} | 2 |
public static void insertTimeAndLocationSickContacts() {
int numSickContacts = 17652991;
int batchSize = 1000;
System.out.println("Starting: insert location and time into sick contact table.");
try {
Connection con = dbConnect();
PreparedStatement update = con.prepareStatement(
"UPDATE "+sickConTbl+"... | 8 |
private boolean compareMethod(String methodNameOfSignature, List<String> parameterTypesOfSignature) {
if(!methodNameOfSignature.equalsIgnoreCase(this.methodName)) return false;
if(parameterTypesOfSignature.size() != this.parameterTypes.size()) return false;
for(String paramInSignature: parameterTypesOfSi... | 4 |
private ListNode getNode(int index)
{
// stores current node
ListNode p;
// throw exception if invalid index
if(index < 0 || index > size())
throw new IndexOutOfBoundsException("getNode index: " + index + "; size: " + theSize);
// determine which end of this LinkedList to start traversal
if(index < th... | 5 |
public void testSetDayOfWeek_int2() {
MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8);
try {
test.setDayOfWeek(8);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals("2002-06-09T05:06:07.008+01:00", test.toString());
} | 1 |
public void gen_orderBy(final Map<String, Object> context, final QLSelect select, final PrintWriter out) {
final Class<?> clazz = (Class<?>) context.get("class");
if (clazz == null) {
throw new IllegalArgumentException("context not contains 'class'");
}
final QLOrderBy orde... | 7 |
public void testGetChronology_Object_nullChronology() throws Exception {
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris"));
assertEquals(GJChronology.getInstance(PARIS), CalendarConverter.INSTANCE.getChronology(cal, (Chronology) null));
cal = new Gregor... | 1 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
if((msg.amISource(mob))
&&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_CHANNEL))
&&((CMath.bset(msg.sourceMajor(),CMMsg.MASK_MO... | 9 |
public static void main(String[] args) {
try {
BufferedReader buff = new BufferedReader(new FileReader(
Global.REPLICA_INPUT_PATH));
String line;
int id = 0;
while ((line = buff.readLine()) != null) {
StringTokenizer st;
st = new StringTokenizer(line, Global.REPLICA_DELIM);
String replica... | 3 |
public boolean hasWorkAtStop(Stop stop) {
List<GoodsType> stopGoods = stop.getCargo();
int cargoSize = stopGoods.size();
for (Goods goods : getGoodsList()) {
GoodsType type = goods.getType();
if (stopGoods.contains(type)) {
if (getLoadableAmount(type) > 0)... | 7 |
public static String getGenChi1LastAtom(String resName){//Get atom name X where generalized chi1 is N-CA-CB-X
if( resName.equalsIgnoreCase("val") || resName.equalsIgnoreCase("ile") )
return "CG1";
else if( resName.equalsIgnoreCase("ser") )
return "OG";
... | 7 |
public String doCheckin() {
if (FacesContext.getCurrentInstance().getExternalContext()
.getSessionMap().containsKey("Administrateur"))
return type = "Administrateur";
else if (FacesContext.getCurrentInstance().getExternalContext()
.getSessionMap().containsKey("Employe"))
return type = "Employe";
Sys... | 7 |
public void createFinalTables(){
c = new String[index.get(0)+1];
for(int i=0;i<=index.get(0);i++){
c[i] = cArray.get(i);
}
b = new String[index.size()-1];
Eqin = new String[index.size()-1];
for(int i=0;i<index.size()-1;i++){
b[i] = bArray.get(i);
if(eqinArray.get(i).matches("\\s?<=?"))
Eqin[... | 6 |
public void calculateSalary(double[] salary){
if(salary == null || salary.length <= 0 ){
return ;
}
double afterTaxTotal = 0 ,totalTax=0;
double[] afterTaxSalary = new double[salary.length];
for(int i = 0 ; i < salary.length ; i++){
if(salary[i] < 4000 && salary[i] >= 0){
afterTaxSalary[i] = salary... | 7 |
public double getItemSubTotal(int rowNumber){
if(rowNumber <= 0) throw new IllegalArgumentException("RowNumber must 1 or higher.");
Product prod = productIndex.get(rowNumber - 1);
Discount disc = prod.getDiscount();
if(disc == null){
return prod.getPrice() * products.get(prod);
}else{
double no... | 3 |
public void printGraphToConsole() {
System.out.println(this+":");
List<String> nodeList = this.getVertexes();
for (String node : nodeList) {
System.out.println("Node:"+node);
List<String> edgeList = this.getIncident(node);
for (String edge : edgeList) {
Edge edgeObj = this.edgeMap.get(edge);
... | 6 |
public void setItem(Item item) {
this.item = item;
} | 0 |
private boolean getCellAt(int x, int y) {
return currentCells[x * width + y];
} | 0 |
public void drawTapeHead(Graphics g)
{
int x = table.getX();
int y = table.getY();
boolean drawState = true;
int tableTapeHeadColIndex = gui.getSimulator().getTape().getTapeHeadColumnIndex()-tapeBeginColumnIndex;
int tableTapeHeadRowIndex = gui.getSimulator().getTape().getTapeHeadRowIndex()-tapeBeginR... | 9 |
public static String joinStrings(String...strs){
if(strs!=null){
StringBuilder sb = new StringBuilder();
for(String str:strs){
sb.append(str);
}
return sb.toString();
}else{
return "";
}
} | 2 |
@EventHandler
public void onLogin(PlayerJoinEvent event){
Player Player = event.getPlayer();
if(!Player.hasPermission("NodeWhitelist.Whitelisted")){
if(!Config.GetString("General.WhitelistingWebsite").equals(null)&&(Config.GetBoolean("General.EnableWebsiteMessages"))){
Player.sendMessage(ChatColor.RED + "[I... | 5 |
public void updateSubTypes() {
if (parent != null
&& (GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
GlobalOptions.err.println("local type changed in: " + parent);
local.setType(type);
} | 2 |
public static BigFloat toBigFloat(final Apfloat from)
throws IllegalArgumentException
{
if (from == null)
return null;
if (from.signum() == 0)
return BigFloat.ZERO;
if (from.equals(Apfloat.ONE))
return BigFloat.ONE;
final int radix = from.radix();
final int digitBits = toDi... | 9 |
@Override
public void openAboutView() {
String aboutTxt =
Constants.PROGRAM_NAME + " " + Constants.VERSION +"\n" +
Constants.CREDITS + "\n\n" +
settings.getLanguage().getLabel("text_used_libraries") + "\n" +
Constants.USED_LIBRARIES;
JOptionPane.showMessageDialog(chatGui,
aboutTxt,
... | 0 |
private int binarySearch(int[] A, int target, int start, int end) {
int mid = (start + end) / 2;
if (target == A[mid]) {
return mid;
} else if (target > A[mid] && mid + 1 <= end) {
if (target < A[mid + 1]) {
return mid + 1;
}
return binarySearch(A, target, mid + 1, end);
} else if (target < A[mi... | 7 |
private void initializeInputControls(){
String useOutStr = appProp.getProperty(KEY_USE_MIDI_OUT);
if(useOutStr == null){
checkMidiOut.setSelected(true);
}else{
boolean useOut = Boolean.parseBoolean(useOutStr);
checkMidiOut.setSelected(useOut);
}
String outStr = appProp.getProperty(KEY_MIDI_... | 9 |
@Basic
@Column(name = "state")
public String getState() {
return state;
} | 0 |
private synchronized void dequeue(Sim_event ev)
{
Packet np = (Packet)ev.get_data();
// process ping() packet
if (np instanceof InfoPacket) {
((InfoPacket) np).addExitTime( GridSim.clock() );
}
if (super.reportWriter_ != null) {
super.write("dequeuin... | 3 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
setEnabled(false);
addActionListener(this);
Outliner.documents.addDocumentListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
} | 0 |
private void BtImprimirHistoricoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtImprimirHistoricoActionPerformed
if(TbHistorico.getRowCount() > 0){
HashMap par = new HashMap();
String relatorio, desc = "";
if(CbPeriodo.isSelected()){
... | 8 |
private boolean solveWithHypothesys() throws SudokuException{
System.out.println("");
System.out.println("******* Nouvelle hypothèse ******");
System.out.println("");
Cell cellForHypothesys = null;
int lastMinValue = matrix.getMatrixSize();
for(int rowIndex=0; rowIndex < matrix.getMatrixSize(); rowIndex++){... | 7 |
protected Ast ParseInput(String code, int whichKind)
{
java.io.StringReader codeStream;
Yylex lexerObj;
Ast programElement;
java_cup.runtime.Symbol parseTree = null;
codeStream = new java.io.StringReader(code);
lexerObj = new Yylex(codeStream);
try
{
if(whichKind == PROCEDURE)
{
Procedu... | 8 |
public void mousePressed(MouseEvent arg0) {
log.logp(Level.FINER, getClass().getSimpleName(), "mousePressed(MouseEvent)",
arg0.getPoint().toString());
if(model.getPortal().isVisible()) {
model.getPortal().mouseClick(arg0.getPoint());
} else if(CheatManager.getInstance().isVisible()) {
CheatManager... | 3 |
@Override
public Meeting getMeeting(int id) {
Iterator meetingIterator = allMeetings.iterator();
Meeting nextMeeting;
int nextId;
while(meetingIterator.hasNext()) {
nextMeeting = (Meeting) meetingIterator.next();
nextId = nextMeeting.getId();
if(ne... | 2 |
public Tetris() {
this.pause = false;
this.jatkuu = true;
this.pisteet = 0;
this.taso = 1;
this.rivit = 0;
this.alkutaso = 0;
this.viive = 2000;
this.onkoAI = false;
this.pelipalikat = new Palikka[20][];
for (int i = 0; i < 20; i++) {
... | 1 |
@Override
public AbstractPlay getBest() {
ArrayList<AbstractPlay> bestPlays = getBestPlays();
return bestPlays.get(rnd.nextInt(bestPlays.size()));
} | 0 |
public static void merge_arrays(Integer[] a, Integer[] b) {
Integer[] merge = new Integer[a.length + b.length];
int i = 0, j = 0, k = 0;
while (k < merge.length) {
if (a[i] <= b[j]) {
merge[k] = a[i++];
} else {
merge[k] = b[j++];
... | 5 |
private Tuple<Vector, Matrix> doLUDecomposition(int which_matrix, Vector b) throws ArithmeticException
{
Double temp = 0d;
Matrix U = clone();
Matrix L = identity();
// Reihenfolge der Vertauschung bei der Pivotstrategie(Permutationen)
Vector lperm = new Vector();
... | 9 |
public void resizeMovingACorner(int corner, int posX, int posY){
int newWidth, newHeight;
if(corner == Drawable.TOP_LEFT_HAND_CORNER){
newWidth = getWidth() + (getOriginX()-posX);
newHeight = getHeight() + (getOriginY()-posY);
setWidth(newWidth);
setHeigth(newHeight);
this.moveOrigin(posX, posY);
... | 4 |
public Player() {
double n = (Math.random() * 10);
switch ((int) n) {
case 0:
name = new String("Stallman");
break;
case 1:
name = new String("Chewbacca");
break;
case 2:
name = new String("Someone");
break;... | 6 |
public boolean canRollNumber(int playerIndex) {
//checks to see if the game status is "Rolling" and that it is actually the players turn to roll
if (serverModel.getTurnTracker().getStatus().equals("Rolling") &&
serverModel.getTurnTracker().getCurrentTurn() == playerIndex) {
return true;
}
else {
retur... | 2 |
private void initializeReportFile()
{
if (!record_) {
return;
}
// Initialize the results file
FileWriter fwriter = null;
try {
fwriter = new FileWriter(super.get_name(), true);
}
catch (Exception ex)
{
ex.printStac... | 4 |
public boolean equals (Mossa other) { // controlla se due mosse sono uguali
if (percorso.length != other.getPercorso().length || pedineMangiabili-other.pedineMangiabili != 0)
return false;
for (int i=0; i<percorso.length; i++) {
if (percorso[i].getX() != other.getPercorso()[i].getX() || percorso[i].ge... | 5 |
public int evalRPN(String[] tokens) {
Stack<String> s = new Stack<String>();
Integer a, b;
for(int i=0; i<tokens.length; i++){
s.push(tokens[i]);
if(s.peek().equals("+")){
s.pop(); //symbol
b = Integer.valueOf(s.pop());
a = Integ... | 5 |
public static int countNeighbours(boolean [][] world, int col, int row){
int total = 0;
total = getCell(world, col-1, row-1) ? total + 1 : total;
total = getCell(world, col , row-1) ? total + 1 : total;
total = getCell(world, col+1, row-1) ? total + 1 : total;
total = getCell(world, col-1, row ) ? total + 1... | 8 |
public void onException(Exception ex) {
ex.printStackTrace();
} | 0 |
public void setContainers(VertexSet S, ArrayList<Path> P){
this.cityList = S;
this.pathList = P;
} | 0 |
public String getResponseTo(String chatName, String sender, String thePhrase) {
// Create new phrase for the statement uttered.
Phrase phrase = new Phrase(sender, thePhrase);
// Get chat object for this chat.
Chat chat = getChatFromName(chatName);
// Add phrase to chat.
... | 7 |
public static final EuclideanNumberPair decipher(BigInteger quotient, int bits, boolean store) {
boolean unsafe = false;
BigInteger product = inverse(quotient, bits);
BigInteger g = gcd(product, quotient);
if (g.longValue() != 1) {// Double check common divisor
// Make sure that "g" truly is common.
l... | 3 |
protected Object fillMap(Object o, TypeToken typeToken, ITestContext iTestContext) {
ITestParamState iTestState = iTestContext.getCurrentParam();
Map<Object, Object> m = (Map<Object, Object>) o;
if ( null != iTestContext.getCurrentParam() && null != iTestContext.getCurrentParam().getAttribute(IT... | 9 |
* @throws IOException if a communication error occurs
* @throws CycApiException if the api request results in a cyc server error
* @throws IllegalArgumentException if the cycObject is not the correct type of thing for
* making into an ELMt
*/
public ELMt makeELMt(Object object)
throws IOExceptio... | 7 |
public String getQuestionText() {
String temp = clientTestHandler.getActiveQuestion().getText();
StringBuilder builder = new StringBuilder(temp);
boolean canDo = true;
final int NEW_LINE = 70;
final int RANGE = 50;
for (int i = 1; i < temp.length() / NEW_LINE; i++) {
... | 5 |
private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
f... | 3 |
public void render(Bitmap bitmap, int offsetX, int offsetY){
// Establish bounds
int xStart = bitmap.x;
int yStart = bitmap.y;
int xEnd = xStart + bitmap.width;
int yEnd = yStart + bitmap.height;
// Bounds check
if(xStart < 0) xStart = 0;
if(yStart < 0) ... | 7 |
public void send(PlayerPawn player, int c, String msg) {
int id = player.getId();
InetAddress ip= player.getIp();
System.out.println("Sending...\nPlayer: " + id + "\tCmd: " + c + "\n");
String data = String.valueOf(id)+c+msg;
byte[] cmd = new byte[512];
try {
... | 1 |
Double getNumber(String strName)
{
try
{
return Double.valueOf(strName);
}catch(NumberFormatException e) { }
if (strName.equalsIgnoreCase("global"))
{
try
{
Variable varStore = engGame.varVariables.getVariable(readScriptForCompile());
if (varStore != null && varStore.isNumber())
{
r... | 7 |
public static void main(String[] args) throws SlickException {
try {
UIManager.setLookAndFeel("com.jtattoo.plaf.graphite.GraphiteLookAndFeel");
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
String ip = JOptio... | 6 |
public final CanecaSintatico.expressaoMultiplicativa_return expressaoMultiplicativa() throws RecognitionException {
CanecaSintatico.expressaoMultiplicativa_return retval = new CanecaSintatico.expressaoMultiplicativa_return();
retval.start = input.LT(1);
Object root_0 = null;
Token set... | 9 |
public HTMLBox(Channel channel, List list, String filename,
boolean generateJavaScript) {
// Note: This code could probably be cleaned up a lot by using the
// Element Construction Set from Apache
// (http://jakarta.apache.org/ecs/index.html). But I didn't want the
// exampl... | 6 |
public boolean Authentification(String login,String pwd){
String requete = "select * from user where Login=? and Password=?";
try
{
PreparedStatement ps = MyConnection.getInstance().prepareStatement(requete);
ps.setString(1,login);
ps.setString(2,pwd);
... | 2 |
private double sigmaFunction2(double sigma, double psi){
// bisection method for psi(delta)
double psiLow = -10*psi;
double pFuncLow = this.psiFunctionQ(psiLow, psi, sigma);
double psiHigh = 10*psi;
double pFuncHigh = this.psiFunctionQ(psiHigh, psi, sigma);
if(pFuncHigh*p... | 6 |
protected void actionPerformed(GuiButton var1) {
if(var1.enabled) {
if(var1.id == 5) {
Sys.openURL("file://" + this.fileLocation);
} else if(var1.id == 6) {
this.mc.renderEngine.refreshTextures();
this.mc.displayGuiScreen(this.guiScreen);
} else {
... | 3 |
public Object clone() {
final Expr[] p = new Expr[params.length];
for (int i = 0; i < params.length; i++) {
p[i] = (Expr) params[i].clone();
}
return copyInto(new CallStaticExpr(p, method, type));
} | 1 |
public static boolean isValidLocation(Coordinate location){
boolean result;
if(location.getX() < Defines.basicMazeSize && location.getX() >= 0 && location.getY() < Defines.basicMazeSize && location.getY() >= 0)
result = true;
else
result = false;
return result;
} | 4 |
private static PecasDecorator menu_principal(Scanner input,Gabinete g) throws IOException{
int opc;
imprimeOpcoes();
opc= input.nextInt();
switch(opc){
case 1: if ( !(g.getDescricao().contains(TipoPeca.PLACA_MAE.toString())) )
return new Placa_Mae(g, menu_marcas(input, Placa_Mae.getListaMarcas()));
else ... | 9 |
public List<Component> getAllComponentsOfType(String componentType, int processorType)
{
// If this is the first build state, we should be querying for processors,
// which require a special query
if(componentType.equals(Build.buildStates[0]))
{
return getAllProcessorsOfType(processorType);
}
// Not ... | 3 |
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... | 3 |
public static boolean isLinear(Production production) {
if (isRightLinear(production) || isLeftLinear(production)) {
return true;
}
return false;
} | 2 |
private Position getNextPosition(int cardinalCount) {
switch (cardinalCount){
case 'N':
return new Position(myPosition.getX(), myPosition.getY()-1);
case 'W':
return new Position(myPosition.getX()-1, myPosition.getY());
case 'S':
... | 3 |
public Identificador get(String nome, int nivel) throws IdentificadorNaoDefinidoException{
for (int i = nivel; i >= 0; i--){
if(tabela.containsKey(i))
if(tabela.get(i).containsKey(nome))
return tabela.get(i).get(nome);
}
throw new IdentificadorNaoDefinidoException(nome, nivel);
} | 3 |
private String getTable( String wikiText, String tableName, int fromIndex ){
int start = wikiText.indexOf( "{{" + tableName, fromIndex);
if(start > 0){
final int length = wikiText.length();
int braces = 0;
for(int end = start; end<length; end++){
... | 5 |
public static Keyword differentSpecialist(ControlFrame frame, Keyword lastmove) {
{ Vector arguments = frame.proposition.arguments;
Cons argumentvalues = Stella.NIL;
boolean unboundargsP = false;
Stella_Object value = null;
lastmove = lastmove;
{ Stella_Object arg = null;
Vect... | 9 |
private static byte[] getFileBytes(String fileName) throws IOException {
FileInputStream fis = new FileInputStream(fileName);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buff = new byte[1024];
int i;
try {
i = fis.read(buff);
while (i != -1) {
bos.write(buff, ... | 2 |
public void testWithFieldAdded2() {
DateTime test = new DateTime(2004, 6, 9, 0, 0, 0, 0);
try {
test.withFieldAdded(null, 0);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
private void animate(int target_x, int target_y, int duration){
float time = duration/(float) animate_timestep;
int steps = (int) time;
if (steps < time) steps++;
float dx = (target_x - animate.x)/time,
dy = (target_y - animate.y)/time;
try {
for (int i=0; i<steps; i++){
animate.x += d... | 3 |
private TermPart getTermPart(Object cl_o, String str_term) {
String lstr_t = str_term.trim();
if(lstr_t.isEmpty()) {
return null;
}
BTLog.debug(this, "getTermPart", "TERM_" + lstr_t + "_TERM");
int li_index = 0;
TermPart lcl_invoke = new TermPart(cl_o);
while(li_index < lstr_t.length()) {
... | 7 |
public void readFile(RegulationFileIterator regulationFileIterator) {
String chromo = "";
int lineNum = 1;
for (Regulation reg : regulationFileIterator) {
// Different chromosome? flush all
if (!chromo.equals(reg.getChromosomeName())) {
if (verbose) Timer.showStdErr("\tChromosome '" + reg.getChromosome... | 5 |
private static String readNextWord() {
char ch = TextIO.peek(); // Look at next character in input.
while (ch != TextIO.EOF && ! Character.isLetter(ch)) {
TextIO.getAnyChar(); // Read the character.
ch = TextIO.peek(); // Look at the next character.
}
... | 7 |
public static List<DisplayMode> getDisplayModes(){
List<DisplayMode> returnableModes = new ArrayList<>();
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
for(DisplayMode mode :modes){
if(mode.getFrequency()==60&& mode.getBitsPerPixel()==32){
... | 4 |
private void deliver (Message m) {
int source = m.getSource();
int destination = m.getDestination();
if (destination != -1) {
unicast(m, getDelay());
} else {
int delay;
boolean drop = false;
boolean first = true;
/* Broadcast. */
for (int i = 1; i <= r.n; i++) {
drop = (source == i && Uti... | 5 |
public void setAvatar(byte[] img, int px) {
switch(px) {
case 16: gravatar_16px = img; break;
case 32: gravatar_32px = img; break;
case 64: gravatar_64px = img; break;
case 128: gravatar_128px = img; break;
case 256: gravatar_256px = img; break;
default: gravatar_256px = img; break;
}
} | 5 |
int test1() {
for (int i = 0; i < 10; i++) {
if (m2(i)) {
if (m2(20)) {
if (m3() > 100)
for (int j = 0; j < 10; j++) {
int y = i;
if (y > 5)
if (m3() < 100) {
System.out.println("heyyy");
}
... | 7 |
@Override
public void transform(double[] src, double[] dst) {
// TODO Auto-generated method stub
for (int i = 0; i < 3; i++)
temp2[i] = src[i];
temp2[3] = 1;
for (int i = 0; i < 3; i++) {
dst[i] = 0;
for (int j = 0; j < 4; j++) {
dst[i] += matrix[i][j] * temp2[j];
}
}
for (int i = ... | 8 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 8 |
public void run() {
while (running) {
receivePacket();
}
} | 1 |
public void nameConfirmed(String s,boolean isAvail) {
if (s.compareTo(name) == 0) {
nameStatus.setText((isAvail)?"Name available!":"Name unavailable");
name = s;
joinButton.setEnabled(isAvail);
if (isAvail && joinChatPressed)
joinChat();
else
joinChatPressed = false;
} else {
joinButton.se... | 4 |
@Override
public void mousePressed(MouseEvent e) {
System.out.println("pressed");
GeoRef mp = new GeoRef(points.size(), e.getX(), e.getY());
double distance = 10;
for (GeoRef p : points) {
if ((p.distance(mp) < distance)) {
sele... | 5 |
public static ArrayList<Vector2D> getTriangleLineIntersects(Triangle A, Line2D B) {
ArrayList<Vector2D> intersects = new ArrayList<Vector2D>();
ArrayList<Line2D> lines = new ArrayList<Line2D>();
lines.add(A.getAB());
lines.add(A.getAC());
lines.add(A.getBC());
for (Line... | 4 |
public void removeRule(String ruleNumber){
String[] numberSplit = ruleNumber.split("-");
Set<String> directoryKeys = directories.keySet();
int i = 0;
int j;
for(String key: directoryKeys){
j = 0;
for(Permission permission: directories.get(key).getPermissi... | 8 |
@Override
public int hashCode() {
return number.hashCode();
} | 0 |
public void dispatch() {
fillMarkerList();
for (numOfThreads = numOfChunks / 2; numOfThreads > 0; numOfThreads /= 2, numOfChunks /= 2) {
if (numOfChunks % 2 == 1) {
oddFlag = true;
} else {
oddFlag = false;
}
mergeThreads = ... | 7 |
private void unloadChunks() {
for (CoordXZ unload : trimChunks) {
if (world.isChunkLoaded(unload.x, unload.z))
world.unloadChunk(unload.x, unload.z, false, false);
}
counter += trimChunks.size();
} | 2 |
private int updateMail() {
int res = 0;
lblError.setVisible(false);
if (Validate.notOverSize(tfNyMail)) {
if (Validate.isEmailFormat(tfNyMail.getText())) {
try {
DB.update("update anstalld set mail = '" + tfNyMail.getText() + "' where aid =" + sele... | 3 |
@Test
public void testRankHappyPath() {
int key = 4;
int result = BinarySearch.rank(N, key);
assertEquals(key, result);
} | 0 |
@Override
public void action() {
ACLMessage msg = myAgent.receive(msgFilter);
if (msg != null) {
if(msg.getConversationId() == null) {
String log = "ConversationId == null : sender: " + msg.getSender().getLocalName()
+ "; content: " + msg.getConten... | 8 |
private void nextPlayer() {
if (round == 1) { // Si l'on est dans le premier tour.
activePlayer++; // On passe au joueur suivant.
if (activePlayer > (nbPlayers-1)) { // Si on depasse le nombre de joueurs total (<=> tous les joueurs ont joue le tour 1).
activePlayer--; // On inverse le sens de jeu (<=> le de... | 5 |
private static void addMetadata( OtuWrapper wrapper, File inFile, File outFile,
boolean fromR) throws Exception
{
HashMap<String, Integer> caseControlMap = getCaseControlMap();
BufferedReader reader = new BufferedReader(new FileReader(inFile));
BufferedWriter writer = new BufferedWriter(new FileWriter(out... | 7 |
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
Guess g = new Guess();
giveIntro();
int numGames = 0; // total number of games user play
int totGuesses = 0; // total number of guesses in all games played
// while or do while loop
... | 8 |
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.