text stringlengths 14 410k | label int32 0 9 |
|---|---|
protected String testName() {
//A little reminder to subclassers
return "*** unknown ***";
} | 0 |
@Action
public void run() {
boolean flag = false;
String strA = jTextArea1.getText().trim();
String strB = jTextArea2.getText().trim();
if(strA.charAt(0) == '-') {
strA = strA.substring(1);
flag = true;
}
if(strB.charAt(0) == '-') {
... | 5 |
@Override
public void mouseClicked(MouseEvent e)
{
if (e.getButton() == MouseEvent.BUTTON3)
{
int row = table.rowAtPoint(e.getPoint());
if (table.getSelectedRowCount() == 0)
table.setRowSelectionInterval(row, row);
MediaContextMenu menu = new MediaContextMenu(getSelected(), table);... | 2 |
@Override
public void paint(final Graphics2D g) {
final AffineTransform oldTransform = g.getTransform();
g.translate(getComponent().getX(), getComponent().getY());
g.setPaint(getComponent().getFgColor());
g.setStroke(getComponent().getFgStroke());
g.draw(getComponent().getS... | 6 |
public ArrayList<Integer> MergeSort (ArrayList<Integer> number, int start, int end){
if (start == end){
ArrayList<Integer> tmp = new ArrayList<Integer>();
tmp.add(number.get(start - 1));
return tmp;
}
// Set mid place
int mid = (end - start + 1) / 2;
... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
LinkedNode<?> other = (LinkedNode<?>) obj;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.va... | 8 |
private boolean jj_3_50() {
if (jj_3R_69()) return true;
return false;
} | 1 |
public String toString(int tab) {
StringBuffer result = new StringBuffer(tabString(tab));
result.append("Recovered type:\n"); //$NON-NLS-1$
if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) {
result.append(tabString(tab));
result.append(" "); //$NON-NLS-1$
}
typeDeclaration.print(tab + 1, result);
if... | 7 |
@Override
public void upDate() {
if(bindBody != null) {
if(grabbed) {
bindBody.setX(x);
bindBody.setY(y);
}
else if(bindBody.getX() != x || bindBody.getY() != y || bindBody.isRemoved() || bindBody.isDead()) {
bindBody.setCantMove(false);
bindBody.setPullAndPush(false);
bindBody = null;
... | 6 |
@Override
public void close() {
try {
this.config.save(this.file);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | 1 |
public boolean equals(Object o) {
if(!(o instanceof Astronomy))
return(false);
Astronomy a = (Astronomy)o;
if(a.dt != dt)
return(false);
if(a.mp != mp)
return(false);
if(a.yt != yt)
return(false);
if(a.night != night)
return(false);
return(true);
} | 5 |
@SuppressWarnings("unchecked")
private static JSONArray getJsonArray(List<Object> messageList) {
JSONArray jsonArr = new JSONArray();
int index = 0;
for (Object object : messageList) {
if (object == null) {
jsonArr.set(index++, JSONNull.getInstance());
} else if (object i... | 7 |
@Test
public void testCreatedEmptyContact() throws Exception {
FiilContactFormParameter validForm = new FiilContactFormParameter("", "", "", "", "", "", "", "", "", "", "", "");
openMainPage();
initContactCreation();
fiilContactForm(validForm);
submitContactForm();
returnToHomePage();
} | 0 |
@Override
public void draw(Graphics g) {
if (trails) {
g.setColor(new Color(0, 0, 0, 30));
g.fillRect(0, 0, width, height);
g.setColor(new Color(20, 20, 20));
for (int i = 0; i < width; i += 50) {
for (int j = 0; j < height; j += 50) {
g.fillRect(i, j, 5, 5);
}
}
}
for (Particl... | 4 |
public void showField() {
for (int i = 0; i < field.sizeField; i++) {
System.out.print(" " + (i + 1) );
}
System.out.println();
for (int i = 0; i < field.sizeField; i++) {
System.out.print(i + 1);
for (int j = 0; j < field.sizeField; j++) {
... | 6 |
private float calcAgeMultiple() {
if (metabolism == ARTILECT_METABOLISM) return 1 ;
final float stage = agingStage() ;
if (actor.species() != null) { //Make this more precise. Use Traits.
return 0.5f + (stage * 0.25f) ;
}
if (stage == 0) return 0.70f ;
if (stage == 1) return 1.00f ;
... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Book other = (Book) obj;
if (id != other.id)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!na... | 7 |
public void testWithPeriodBeforeEnd3() throws Throwable {
Period per = new Period(0, 0, 0, 0, 0, 0, 0, -1);
Interval base = new Interval(TEST_TIME_NOW, TEST_TIME_NOW);
try {
base.withPeriodBeforeEnd(per);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public static void sed(InputStream inputStream, OutputStream outputStream, Map<Pattern, String> patternReplacements) throws IOException {
if(patternReplacements == null || patternReplacements.isEmpty()) {
return;
}
Scanner scanner = new Scanner(inputStream).useDelimiter(Pattern.compile("\n"));
while(scanner... | 6 |
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... | 6 |
* @Post: no changes
* @Return: whether or not this point is under attack by an enemy knight
*/
private boolean knightsCanAttack(Point pointToCheck) {
// TODO Auto-generated method stub
ArrayList<Point> possibleKnightAttacks= new ArrayList<Point>();
//adds all L shaped shifts from the pointToCheck to the lis... | 7 |
public static PathQuad load(BufferedReader reader, ArrayList<Entity> props) {
String line;
try {
line = reader.readLine();
String[] temp = line.split(";");
BufferedImage hitmap = new BufferedImage(Integer.parseInt(temp[0]), Integer.parseInt(temp[1]), BufferedImage.TYPE_INT_RGB);
PathQuad.size = new ... | 6 |
public final void setBill(double bill) {
if(bill < minBill) {
throw new IllegalArgumentException(billEntryError);
}
this.bill = bill;
} | 1 |
@Override
public ByHandleFileInformation onGetFileInformation(String arg0,
DokanFileInfo arg1) throws DokanOperationException {
EntityInfo inf;
if (mapWinToUnixPath(arg0).equals(INITIALFILENAME))
{
return new ByHandleFileInformation(net.decasdev.dokan.FileAttribute.FILE_ATTRIBUTE_NORMAL, 0, 0, 0, 0, 0, 1, ... | 6 |
public CircleChain(Graph g, Dimension vDim, double vBuffer) {
super(g);
radius = 0;
vertexDim = vDim;
vertexBuffer = vBuffer;
} | 0 |
public static void main(String[] args) {
System.out.println("Prueba de conexion con MS SQLServer");
String entrada="",salida="",opc="";
SQL= new AdaptadorSQL("localhost","1433","prueba","pekosog","sped1920");
System.out.println(SQL.getMeta());
do{
System.out.println("Opciones de Uso:\n1.-Ejecutar Query... | 5 |
private boolean jj_3R_43() {
if (jj_scan_token(FOREACH)) return true;
if (jj_3R_72()) return true;
if (jj_scan_token(IN)) return true;
return false;
} | 3 |
public static Complex[] fft(Complex[] x) {
int N = x.length;
// base case
if (N == 1) return new Complex[] { x[0] };
// radix 2 Cooley-Tukey FFT
if (N % 2 != 0) { throw new RuntimeException("N is not a power of 2"); }
// fft of even terms
Complex[] even = new C... | 5 |
public static String stringForResponseCode(int code)
{
switch ( code )
{
case 200:
return "OK";
case 401:
return "Not Authorized";
case 403:
return "Forbidden";
case 404:
return "Not Found";
case 500:
return "Internal Server Error";
case 501:
return "Not implemented";
d... | 6 |
private void getEdgesInChildrenCells(S2Point a, S2Point b, List<S2CellId> cover,
Set<Integer> candidateCrossings) {
// Put all edge references of (covering cells + descendant cells) into
// result.
// This relies on the natural ordering of S2CellIds.
S2Cell[] children = null;
while (!cover.isE... | 8 |
public static List<ScheduleTeamModel> getAllTeamSchedulesNotStarted(String order) {
List<ScheduleTeamModel> res = new ArrayList<ScheduleTeamModel>();
for(ScheduleTeamModel stm : getAllTeamSchedulesByFinish(order,false)) {
if(!stm.isSched_isStart())
res.add(stm);
}
return res;
} | 2 |
private int compareType(int t1, int t2) {
return (t1 < t2) ? 1 : (t1 == t2) ? 0 : -1;
} | 2 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException{
request.setCharacterEncoding("UTF-8");
RequestData rd = getRequestData(request);
Class clazz;
try{
clazz = Class.forName(... | 4 |
public static void main(String[] args){
Scanner cin = new Scanner(System.in);
str = cin.next();
for(int i = 0; i != str.length(); i ++)
digits[intValue(i)] ++;
boolean flag = true;
int carry = 0;
for(int i = str.length() - 1; i >= 0; i--){
result[i] = intValue(i)*2%10 + carry;
digits[result[i]]... | 8 |
private static void maxHeapify(Comparable[] arr, int i, int n){
//getting the left node of this node
//while the j is less than the size of the array
while(i*2+1<n) {
int j = i*2+1;
//checking if the right is less than the left node
//if not then choose the r... | 4 |
public double getQuizRating() {
String statement = new String("SELECT * FROM " + DBTable + " WHERE qid = ?");
PreparedStatement stmt;
try {
stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, quizID);
ResultSet rs = stmt.executeQuery();
rs.next();
double averageRating;
if(rs.getI... | 2 |
public static void tempMutePlayer( final BSPlayer t, int minutes ) throws SQLException {
mutePlayer( t.getName() );
BungeeSuite.proxy.getScheduler().schedule( plugin, new Runnable() {
@Override
public void run() {
if ( t.isMuted() ) {
try {
... | 2 |
public JSONObject increment(String key) throws JSONException {
Object value = opt(key);
if (value == null) {
put(key, 1);
} else if (value instanceof Integer) {
put(key, ((Integer) value).intValue() + 1);
} else if (value instanceof Long) {
put(key, ((... | 5 |
public Battleship()
{
setTitle("Battleship");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setJMenuBar(createMenuBar());
setResizable(false);
//gets user to input name
user=JOptionPane.showInputDialog("Enter your name.");
int dummy=0;
while (((user==null)||(user.equals("")))&&(dummy<3))
{
... | 6 |
@SuppressWarnings("unchecked") // FIXME in Java7
public SelectDestinationDialog(FreeColClient freeColClient, GUI gui, Unit unit) {
super(freeColClient, gui);
// Collect the goods the unit is carrying.
final List<GoodsType> goodsTypes = new ArrayList<GoodsType>();
for (Goods goods : ... | 9 |
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
Library library = new Library();
JSONObject result = new JSONObject();
try {
library.checkOutBook(
Integer.parseInt(request.getParameter("bookNumber")),
((Patron) request.getSessi... | 2 |
@Override
public void deserialize(Buffer buf) {
casterId = buf.readInt();
targetCellId = buf.readShort();
if (targetCellId < 0 || targetCellId > 559)
throw new RuntimeException("Forbidden value on targetCellId = " + targetCellId + ", it doesn't respect the following condition : t... | 5 |
@SuppressWarnings("unchecked")
public static <T> T[] addElemToArray(T[] array, T element, int index) {
if (array == null) {
array = (T[]) Array.newInstance(element.getClass(), (index + 1));
array[index] = element;
return array;
}
if (index < array.length) {
array[index] = element;
return array;
... | 2 |
public static int dfs(int num, int sumGreedy, int sum, int indexIzq, int indexDer, int turn, String cadSum, String cadgreedy) {
if (indexIzq <= indexDer) {
if (turn == 0) {
if (arr[indexIzq] >= arr[indexDer]) {
if (dp[indexIzq][indexDer] != Integer.MIN_VALUE) {
value = (sum - (sumGreedy + arr[index... | 8 |
private void writePage() // writes page information
{
writeNumber(0,2,attrib,false);
writeNumber(0,2,key_cnt,false); // count of keys in this block
writeNumber(0,4,left_page,true); // left node or -1
writeNumber(0,4,right_page,true); // right node or -1
for(int i=0;i<key_cnt;i++)
{
// write keys
t... | 2 |
private void parseChar() throws CompilationException {
char ch=0;
switch(read()) {
case '\\':
ch=(char)parseEscape();
break;
case -1: // EOF
case '\n':
case '\r':
case '\'':
// these can't be encountered inside char literal
consume(-1);
break;
default:
... | 5 |
private void scan(MethodInsnNode methodInsnNode) {
for (ThreatClass threatClass : threatClasses) {
if (threatClass.getName().equals(methodInsnNode.owner)) {
threatClass.setUsed();
if (methodInsnNode.name.equals("<init>"))
addInteraction(threatClass, methodInsnNode);
for (ThreatMethod threatMethod ... | 5 |
double isNotEqual(MembershipFunction mf, InnerOperatorset op) {
if(mf instanceof FuzzySingleton)
{ return op.not(isEqual( ((FuzzySingleton) mf).getValue())); }
if((mf instanceof OutputMembershipFunction) &&
((OutputMembershipFunction) mf).isDiscrete() ) {
double[][] val = ((OutputMembershipFunction)... | 9 |
static int solve(int a, int b) {
if (a >= n)
return 0;
if (dp[a][b] != 0)
return dp[a][b];
if (a == b)
return dp[a][b] = 1;
int r = b - a + 1;
for (int i = a; i <= b; i++)
for (int l = 1; l <= i - a + 1; l++)
if (check(a, i, l)) {
if (i == b && l == (b - a + 1))
continue;
r = ... | 8 |
public boolean isLand(String cardName){
if(cardName.equalsIgnoreCase("mountain"))
return true;
if(cardName.equalsIgnoreCase("island"))
return true;
if(cardName.equalsIgnoreCase("forest"))
return true;
if(cardName.equalsIgnoreCase("plains"))
return true;
if(cardName.equalsIgnoreCase("sw... | 5 |
private static void recordChanges(String str) {
int changes = 0;
char []ch = str.toCharArray();
int i=0,j=ch.length-1;
while(i<j){
if(!(ch[i]==ch[j])){
//System.out.println(ch[i] + "->"+ ch[j]);
changes+= Math.abs(ch[i] - ch[j]);
}
i++;
j--;
}
System.out.println(changes);
... | 2 |
private Box LoadPhoto(String number)
{ File f=null;
ImagePanel ImagePanel = new ImagePanel();
ImagePanel.setLayout(new BorderLayout());
if(Phone.numbers.get(number)!=null) f=new File(Phone.PhotoFolder + Phone.numbers.get(number).get(1));
if(f==null||f.equals(null)) f=new F... | 4 |
@Override
public final void setInitialState() {
for (int i = 0; i < contents.length; i++) {
Cell[] tempArray = new Cell[8];
for (int j = 0; j < tempArray.length; j++) {
if ((i + j) % 2 == 0) {
tempArray[j] = new Cell(i, j);
}
... | 8 |
public static void killMetaInf() {
File inputFile = new File(System.getenv("APPDATA") + "/.MinebookLauncher/packs/" + downloadPack.packID + "/minecraft/bin", "minecraft.jar");
File outputTmpFile = new File(System.getenv("APPDATA") + "/.MinebookLauncher/packs/" + downloadPack.packID + "/minecraft/bin", "... | 5 |
public static void main(String[] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(args[0])));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(args[1])));
String lineString;
while((lineString = in.readLine()) != n... | 4 |
private void computeRootNodeStatistics() {
// Compute mean per dimension from all objects.
double[] mean = new double[numberOfDimensions];
for (int i = 0; i < numberOfDimensions; i++) {
mean[i] = 0;
for (int j = 0; j < numberOfObjects; j++) {
mean[i] += data[j][i];
}
}
double divFactor = 1.0 / nu... | 5 |
private static int distance(Person a, Person b) {
HashSet<Person> visited = new HashSet<Person>();
HashMap<Person, Person> previous = new HashMap<Person, Person>();
LinkedList<Person> queue = new LinkedList<Person>();
queue.add(a);
visited.add(a);
Person p = a;
while (!queue.isEmpty()) {
p = queue.remo... | 6 |
private void generateCircle(int index) {
//This method generates a new circle.
//TODO: rewrite this more gracefully.
outer:
while (foci[index] == null) {
//let's look for a new coordinate.
double randx = r.nextDouble() * DWIDTH;
double randy = r.nextDo... | 6 |
public List<Bin> getGenesByDivision(Pair div) {
List<Bin> genes = new ArrayList<Bin>();
for(int i = div.x; i < div.y; i++){
genes.add(this.bins.get(i));
}
return genes;
} | 1 |
private void colisionesNaves() {
for (Nave n : naves) {
if(n.isVivo()){
int colisionesMortales = n.colisionesMisDisparosConList(invasores);
if(colisionesMortales>0){
juego.setPuntos(juego.getPuntos() + colisionesMortales);
}
... | 3 |
@Test
public void RandomSet() {
//Make two identical models but one parallel and one sequential
AbstractModel paraModel=DataSetLoader.getRandomSet(100, 800, 40, new ModelParallel());
AbstractModel seqModel=DataSetLoader.getRandomSet(100, 800, 40, new Model());
//Step through each model stepNumber
stepModel(... | 3 |
private static void editarTienda()
{
boolean salir;
String nombre, cif, codigo;
Integer idTienda;
Tienda tienda;
do
{
try
{
System.out.print( "Introduce el Id de la tienda: ");
idTienda = Integer.parseInt( scanner.nextLine());
if ((tienda = Tienda.buscar( idTienda)) == null)
... | 6 |
@Override
public final void testStarted(Description description) throws Exception {
super.testStarted(description);
selectListener(description).testStarted(description);
} | 0 |
public void testNoInterveningTiles() {
// Place a tree in the middle
board.addTile(tree, CENTRE, CENTRE);
try {
// Check illegal arguments aren't accepted
board.validateNoInterveningTiles(CENTRE - 1, CENTRE - 1, CENTRE + 1, CENTRE);
fail("Method shouldn't accept diagonal moves");
... | 6 |
public void merge(int[] arrayA, int[] arrayB, int tailA, int tailB) {
int lastA = tailA + tailB + 1;
while (tailA > -1 && tailB > -1) {
if (arrayA[tailA] > arrayB[tailB]) {
arrayA[lastA] = arrayA[tailA];
lastA--;
tailA--;
} else {
... | 4 |
private void consumeMaterials() {
//
// Decrement stocks and update demands-
final float wear = Structure.WEAR_PER_DAY / World.STANDARD_DAY_LENGTH ;
final int maxPop = HoldingUpgrades.OCCUPANCIES[upgradeLevel] ;
float count = 0 ;
for (Actor r : personnel.residents()) if (r.aboard() == this) cou... | 4 |
public static void main(String [] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setText(getResourceString("window.title"));
InputStream stream = BrowserExample.class.getResourceAsStream(iconLocation);
Image icon = new Image(display, strea... | 3 |
public String toString() {
boolean test = false;
if (test || m_test) {
System.out.println("Grid :: toString() BEGIN");
}
String gridString = "";
for (int y = 0; y < getGridHeight(); ++y) {
for (int x = 0; x < getGridWidth(); ++x) {
gridString += m_Grid[x][y] + "... | 6 |
public static boolean bingo(int[][] board, int[] drawn) {
// the size of the board.
int size = board.length;
// This array keeps track of filled array.
boolean filled[][] = new boolean[size][size];
// Mark the center of the board as filled.
if (size % 2 != 0) {
... | 9 |
public static List<Enhancement> getEnhancements(String prestige, List<Integer> requiredList){
List<Enhancement> el = new ArrayList<Enhancement>();
for(ClassTree ct : takenPrestigeTrees){
if(ct.getPrestige().equalsIgnoreCase(prestige)){
for (int i : requiredList){
el.add(ct.getEnhancement(i));
... | 5 |
@Override
public GameMap generateMap(boolean visual, int x, int y) {
this.visual = visual;
numFloor = (int) (x * y * percentFill);
GameMap retMap = new GameMap(x, y);
retMap.fillMap(MapCellWall.getInstance());
for (int i = 0; i < initFloors; i++) {
retMap.setCell... | 8 |
public ListaContaCorrente contasComSaldoLista(double valor)
{
ListaContaCorrente l = new ListaContaCorrente(this.quantasContas);
for(int i=0; i < this.quantasContas; i++)
{
if (this.aContas[i].getSaldo() > valor)
{
l.incluirNoFim(this.aContas[i]);
... | 2 |
@Override
public void actionPerformed(ActionEvent e){
view.getDisplayArea().setText(null);
try{
if (e.getSource() == view.btnAddFile) this.addDiseaseFile();
if (e.getSource() == view.btnAddPatient) this.addPatient();
if (e.getSource() == view.btnRemovePatient) this.removePatient();
if (e.getSource() =... | 9 |
public static void displayHighScore() throws ClassNotFoundException, IOException {
Player[] hsList = HighScore.getHSList();
for (int i=0; i < hsList.length; i++){
if (hsList[i]!=null){
SimoneUI.HighScoreUI.append(hsList[i].toString()+ "\n");
}
if (hsList[i]... | 3 |
private void jTextFieldUtilisateurRechercheKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldUtilisateurRechercheKeyReleased
try {
List<projetrf.model.Ville> vv1 = RequetesVille.rechercheVilleByCp(jTextFieldUtilisateurRecherche.getText());
... | 2 |
public void parse()
{
try
{
program();
}
catch (QuitParseException e)
{
error.reportSyntaxError();
}
} | 1 |
public void plusEquals(Matrix bmat){
if((this.numberOfRows!=bmat.numberOfRows)||(this.numberOfColumns!=bmat.numberOfColumns)){
throw new IllegalArgumentException("Array dimensions do not agree");
}
int nr=bmat.numberOfRows;
int nc=bmat.numberOfColumns;
for(int... | 4 |
public Candlestick(double abertura, double fechamento, double minimo,
double maximo, double volume, Calendar data) {
if (minimo >= maximo) {
throw new IllegalArgumentException(
"Preço mínimo não pode ser maior que o preço máximo.");
}
if (data == null) {
throw new IllegalArgumentException("Data nã... | 7 |
public static float doFrictionX(float xv, float yv, float FRICTION) {
float angle = (float) Math.atan(yv / xv);
if (xv == 0) {
if (yv == 0) {
angle = 0;
}
angle = (float) Math.PI / 2;
}
// apply friction
float fx = Math.abs(FRI... | 6 |
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
ArrayList<Integer> ints = new ArrayList<Integer>(4);
try {
while (true) {
try {
System.out.print("Input at least 3 numbers seperated by spaces: ");
... | 6 |
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... | 6 |
private static byte[] readEntry(final InputStream zis, final ZipEntry ze)
throws IOException {
long size = ze.getSize();
if (size > -1) {
byte[] buff = new byte[(int) size];
int k = 0;
int n;
while ((n = zis.read(buff, k, buff.length - k)) > 0) {
k += n;
}
return buff;
}
ByteArrayOutpu... | 3 |
private ArrayList<ASTatom> fetchExpressions(SimpleNode n,
boolean ignoreLocals) {
// ignore choice rules and aggregates in case ignore locals was set to
// true
ArrayList<ASTatom> result = new ArrayList<ASTatom>();
if (ignoreLocals
&& (n.getId() == ElpsTranslatorTreeConstants.JJTAGGREGATE || n
.g... | 9 |
private void setIconPositionAndVisibility(String labelName, ImageIcon imgicon, boolean isVisible)
{
//"woman" 80,50, "smallDragon" 240,250, "genie" 280,150, "onyxia" 0,0
if (labelName.equals("woman"))
{
womanLabel.setIcon(imgicon);
mainpanel.add(womanLabel);
... | 9 |
public static boolean cloneTaskTree() {
Data data=new Data("SomeData");
IDGenerator generator = new IDGenerator();
TaskTree tree1 = new TaskTree(generator, data);
TaskTree child1 = new TaskTree(generator, data);
tree1.add(child1);
TaskTree child2 = new TaskTree(generator,... | 6 |
public void CaptureWhitePiece(int r1, int c1, int r2, int c2)
{
// Check Valid Capture
assert(Math.abs(r2-r1)==2 && Math.abs(c2-c1)==2);
// Obtain the capture direction
MoveDir dir = r2<r1?(c2<c1?MoveDir.forwardRight:MoveDir.forwardLeft)
:(c2<c1?MoveDir.ba... | 8 |
@Override
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final ClientInfo other = (ClientInfo) obj;
if (socket == null)
{
if (other.socket != null)
{
return fa... | 6 |
private double RoundUp(double val) {
int exponent;
int i;
exponent = (int) (Math.floor(SpecialFunction.log10(val)));
if (exponent < 0) {
for (i = exponent; i < 0; i++) {
val *= 10.0;
}
}
else {
for (i = 0; i < exponent; i++) {
val /= 10.0;
}
}
if (val > 5.0)
val = 10.0;
else ... | 9 |
public String toString() {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < array.length; i++) {
sb.append("Vector[" + i + "] = " + array[i]);
if (i < array.length - 1) {
sb.append("\n");
}
}
return sb.toString();
} | 2 |
@Override
public void recycle(Object t) {
if (!(t instanceof HugeElement)) return;
switch (((HugeElement) t).hugeElementType()) {
case Element:
if (elements.size() < allocationSize)
elements.add((TE) t);
break;
case BeanImpl:
if (impls.size() < allocationSize)
... | 5 |
private HashSet<AbstractTile> getTilesToHighlightHelper(AbstractTile tile, HashSet<AbstractTile> tileSet, int radius) {
if(radius == 0) {
return tileSet;
}
//if(!(tile.getX()/Main.TILE_SIZE < Main.BOARD_DIMENSION_BY_TILE.width) || !(tile.getY()/Main.TILE_SIZE < Main.BOARD_DIMENSION_BY_TILE.height)) {
/... | 9 |
public void testConstructor_RI_RD5() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Duration dur = new Duration(-1);
try {
new Interval(dt, dur);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
private void setSourceBuffer(int i) {
if (disabled)
return;
SoundObject obj = soundObjects.get(i);
OggDecoder oggDecoder = new OggDecoder();
ByteBuffer databuffer = ByteBufferBuffer.alloc(2048 * 2048);
try {
InputStream f = Loader.getRequiredResourceAsStr... | 9 |
public void setZeros(int[][] matrix){
Boolean[] rows = new Boolean[matrix.length];
Boolean[] cols = new Boolean[matrix[0].length];
for(int i = 0; i < rows.length; i++){
rows[i] = false;
}
for(int i = 0; i < cols.length; i++){
cols[i] = false;
}
for(int i = 0; i < matrix.length; i++){
for... | 9 |
public static void main(String[] args) {
try {
System.out.println("If args are given: FILEPATH REPETITION ITERATION TEMPERATURE");
String filepath = "/home/mik/Documenti/univr/Ragionamento Automatico/stage/report/200/0.29/2.pg";
if (args.length >=1){
filepath... | 6 |
public static void testStrings(){
// Learn to use conditional operator instead of if... else statement
int a , b;
a = 10;
b = (a == 1) ? 20: 30;
System.out.println( "Value of b is : " + b );
b = (a == 10) ? 20: 30;
System.out.println( "Value of b is : " + b );
... | 5 |
@Override
public void toString(String indent, StringBuilder buffer)
{
final int size = this.tags.size();
if (size == 0)
{
buffer.append("[]");
return;
}
buffer.append("[ ");
this.tags.get(0).toString(indent, buffer);
for (int i = 1; i < size; i++)
{
buffer.append(", ");
this.tags.get(i).... | 2 |
public static void main(String[] args) {
try {
initBase();
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(1);
}
// Warm up the nanoTime function
for(int i = 0; i < 10000; i++) {
System.nanoTime();
}
... | 5 |
public void init() {
if (!runOnCanvas) {
final BufferedImage bi = new BufferedImage(2, 2, BufferedImage.TYPE_INT_ARGB);
cs.handleResize();
cs.needAnalyze();
cs.updateCircuit(bi.getGraphics());
// cs.analyzeCircuit();
updateThread = new Threa... | 9 |
public void move() {
// if (target == null) {
int dist = 1000;
for (Organism g : Ecosystem.getYellow()) {
if (getDist(g) < dist) {
target = g;
dist = getDist(g);
}
}
for (Organism g : Ecosystem.getRed()) {
if (getDist(g) < dist) {
target = g;
dist = ... | 7 |
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.