text stringlengths 14 410k | label int32 0 9 |
|---|---|
protected Operation [] getOptimalOperations(BayesNet bayesNet, Instances instances, int nrOfLookAheadSteps, int nrOfGoodOperations) throws Exception {
if (nrOfLookAheadSteps == 1) { // Abbruch der Rekursion
Operation [] bestOperation = new Operation [1];
bestOperation [0] = getOptimalOperatio... | 7 |
public static void main(String[] args) {
String configFile = "snpEff.config";
String genomeToTest = "";
// Parse command line arguments
if (args.length <= 0) {
System.err.println("Usage: TestCaseCompareCds genomeToTest\n");
System.exit(-1);
}
// Command line argument parsing
if (args[0].equals("-c... | 3 |
@Override
public void run() {
try {
String line;
while (!isInterrupted()) {
line = in.readLine();
if (line != null)
try {
queue.offer(line);
} catch (NullPointerException npe) {
System.out.println("failed message offer");
}
else
close();
}
} catch (IOException e... | 4 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
* to str... | 9 |
public Matrix plus(Matrix m)
{
//Once again test the boudns of each matrix.
if(this.numRows != m.numRows || this.numColumns != m.numColumns){
System.out.println("Error: matrix arguments are not compatible for addition!");
return null; // placeholder
}
//Perform normative addition
int[][] result = ne... | 4 |
protected Notification tryRegister(Iterable<? extends Converter> converters) {
Notification notification = new Notification();
if(converters == null)
return notification;
// XXX can't use foreach here, since the hasNext() and next() operations themselves may fail
try {
Map<Converte... | 9 |
public Rover(Integer x, Integer y, String direction) {
super();
if (x == null) {
throw new IllegalArgumentException("X co-ordinate can't be NULL");
}
if (x < this.minBorder || x > this.maxBorder) {
throw new IllegalArgumentException("X co-ordinate must be within 0 - 9");
}
if (y... | 9 |
public TextLogger(String filename) {
datestampformat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss");
timestampformat = new SimpleDateFormat("'['H':'mm':'ss'] '");
cal = Calendar.getInstance();
datestamp = datestampformat.format(cal.getTime());
try {
if (writer != null)
writer.close();
file... | 3 |
public static boolean createFile(File file) throws IOException {
if(! file.exists()) {
makeDir(file.getParentFile());
}
return file.createNewFile();
} | 1 |
public double[][] getGridDydx2(){
double[][] ret = new double[this.nPoints][this.mPoints];
for(int i=0; i<this.nPoints; i++){
for(int j=0; j<this.mPoints; j++){
ret[this.x1indices[i]][this.x2indices[j]] = this.dydx2[i][j];
}
}
... | 2 |
static double incompleteBetaFraction2( double a, double b, double x ) {
double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
double k1, k2, k3, k4, k5, k6, k7, k8;
double r, t, ans, z, thresh;
int n;
k1 = a;
k2 = b - 1.0;
k3 = a;
k4 = a + 1.0;
k5 = 1.0;
k6 = a + b;
k7 = a + 1.0;;
... | 7 |
public void doTest() {
props.put("newKey1", "newVal1");
props.put("newKey2", "newVal2a=newVal2b");
props.put("newKey3", "items " + String.valueOf(props.size()+1) );
Iterator iter = props.entrySet().iterator();
while(iter.hasNext()) {
Map.Entry entry = (Map.Entry)iter.next();
... | 1 |
public static void main(final String[] args) {
final int x = 1000;
for (int i = 1; i < (x + 1); i++)
for (int j = 1; j < (x + 1); j++)
for (int z = 0; z < x; z++) {
final int k = j + z;
if ((((i * i) + (j * j)) == (k * k)) && (i < j))
if ((i + j + k) == x)
// System.out.println("... | 6 |
public String toString() {
return this.operatingSystem.toString() + "-" + this.browser.toString();
} | 0 |
public void removeKeyListener(KeyListener l) {
if(l == null) {
return;
}
this.keyListener = null;
} | 1 |
Space[] won() {
int n = numToWin - 1;
if (lastSpaceMoved == null)
return null;
int[] pos = lastSpaceMoved.getPos();
for (int i = 0, rowInd = pos[0]; i <= n; i++, rowInd = pos[0] - i)
for (int j = 0, colInd = pos[1]; j <= n; j++, colInd = pos[1] - j) {
boolean outOfBounds = rowInd < 0 || colInd < 0
... | 9 |
private String escapeXMLAttribute(String text) {
text = StringTools.replace(text, "&", "&");
text = StringTools.replace(text, "<", "<");
text = StringTools.replace(text, "\"", """);
text = StringTools.replace(text, ">", ">");
return text;
} | 0 |
public static void makeRandomDouble(Matrix matrix) throws MatrixIndexOutOfBoundsException {
int rows = matrix.getRowsCount();
int cols = matrix.getColsCount();
double temp = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
// fill with ran... | 2 |
public int size() {
return this.length;
} | 0 |
@Override
public String getErrorPath() {
System.out.println("getErrorPath");
return super.getErrorPath();
} | 0 |
public void handlePackReply(Node sender, Node receiver, PackReplyOldBetEtx message) {
// o sink nao deve manipular pacotes do tipo Relay
if(this.ID == message.getSinkID()){
return;
}
double etxToNode = getEtxToNode(message.getFwdID());
// necessaria verificacao de que o no ja recebeu menssagem de ... | 6 |
public DisplayMode findFirstCompatibleMode(DisplayMode modes[]){
DisplayMode goodModes[] = vc.getDisplayModes();
for(int x=0;x<modes.length;x++){
for(int y=0;y<goodModes.length;y++){
if(displayModesMatch(modes[x], goodModes[y])){
return modes[x];
}
}
}
return null;
} | 3 |
@Override
public final boolean isDebug() {
return debug;
} | 0 |
private String getPropertyValue(Properties properties, String key) {
String value = properties.getProperty(key);
if (!key.contains("$") && (value == null || !value.contains("$"))) {
return value;
} else {
if (key.contains("$")) {
value = key;
}
String[] array = value.split("\\$");
for (int i = ... | 8 |
public void menuAction(JMenu selectMenu) {
MainFrame mainFrame = MainFrame.getInstance();
AttdFrame workingFrame = mainFrame.getCurrentFrame();
workingFrame.setVisible(false);
for (int i = 0; i < menu.length; i++) {
if (menu[i].equals(selectMenu)) {
switch(i) {
case 0:
mainFrame.setCurrentFrameE... | 8 |
public String getUsername()
{
return username;
} | 0 |
public int compare(TradeOrder order1, TradeOrder order2)
{
if ((order1.isMarket()) && (order2.isMarket()))
{
return 0;
}
else if ((order1.isMarket()) && (order2.isLimit()) || (order1.isLimit()) && (order2.isMarket()))
{
return -1 * (int) Math.random() * 99; //Fun random negative value (kind of unnecess... | 7 |
public void setSalary(double newSalary)
{
if(newSalary >= 0.0)
{
salary = newSalary;
}
} | 1 |
@Override
public Map<String, String> getParsedResults() {
if (!resultingMap.isEmpty()) {
return resultingMap;
}
String[] lines = stringBuilder.toString().split("\n");
for (String line : lines) {
line = line.trim();
if (line.startsWith("时间:")) {
parseStartAndEndTime(line.substring("时间:".length()));... | 4 |
private void reduce_0(int reduction) throws IOException, LexerException, ParserException
{
switch(reduction)
{
case 0: /* reduce AFactorExpr */
{
ArrayList<Object> list = new0();
push(goTo(0), list, false);
}
break;
... | 9 |
public List<File> filterDirectories() {
List<File> f = new ArrayList<File>();
for (String s : l) {
File sf = new File(s);
if (sf.isDirectory() && sf.exists()) {
f.add(sf);
}
}
return f;
} | 3 |
public static boolean isTheft(int s) {
if(s==53185)
return true;
return false;
} | 1 |
public void clicked() // changes the color of the buttons and if [x][y] is
// "0" set the label to nothing
{
for (int x = 0; x < row; x++) {
for (int y = 0; y < col; y++) {
if (checkwinbool[x][y] == true && flag[x][y] == false && bomb[x][y] == false)
table[x][y].setBackground(Color.darkGray);
... | 7 |
public void draw(Graphics g){
if(kind==1)
g.setColor(new Color(0,255,255,(int)(alpha*255)));
else if(kind==2)
g.setColor(new Color(255,0,255,(int)(alpha*255)));
else if(kind==4)
g.setColor(new Color(0, 255, 0, (int) (alpha * 255)));
else
g.... | 3 |
@Override
public void applyTemporaryToCurrent() {cur = tmp;} | 0 |
public ArrayList<Node> generateDoubleStart(int k, int type){
ArrayList<Node> nodes = new ArrayList<Node>();
for(int i =0;i<2*k;i++)
{
nodes.add(new Node(i));
}
Link link;
// Create first star with centre node k-1
for(int i=0;i<k-1;i++)
{
... | 6 |
public GameCanvas(ProBotGame game) {
this.game = game;
setIgnoreRepaint(true);
setFocusable(false);
} | 0 |
private void setConfig()
{
HashMap<String,Object> pl = null;
Yaml yamlCfg = new Yaml();
Reader reader = null;
try {
reader = new FileReader("plugins/Clans/Config.yml");
} catch (final FileNotFoundException fnfe) {
System.out.println("Config.YML Not Found!");
try{... | 5 |
public IncomingPeerListener(int port) {
super("TorrentListener");
log.debug("Binding incoming server socket");
while (port < 65535 && serverSocket == null) {
try {
serverSocket = new ServerSocket(port);
} catch (Exception e) {
log.debug("Ca... | 6 |
public void computerTurn()
{
myFrame.getContainerPanel().getButtonPanel().disableButton("s");
myFrame.getContainerPanel().getButtonPanel().disableButton("h");
myFrame.getContainerPanel().getButtonPanel().disableButton("n");
while (cHand.getHandValue() <= pHand.getHandValue() && cHand... | 6 |
public boolean containsFiveNinesNoMeld() {
int numberOfNines = 0;
for (Card card : currentCards) {
if(card.face.equals(Face.Nine))
numberOfNines++;
}
if(numberOfNines >= 5 && new CalculateMeld(null, currentCards).calculate() == 0)
return true;
return false;
} | 4 |
@Test
public void placeFiguresKnightAndKing() {
HashMap<String, Integer> figureQuantityMap = new HashMap<>();
figureQuantityMap.put(KNIGHT.toString(), 2);
figureQuantityMap.put(KING.toString(), 2);
FiguresChain figuresChain = new King(figureQuantityMap);
figuresChain.setNext... | 7 |
public Node<T> reverse(Node<T> p_linkedList, Node<T> p_linkedList1, Comparator<T> p_comparator) {
if(p_linkedList == null) {
return p_linkedList1;
}
if(p_linkedList1 == null) {
return p_linkedList;
}
Node<T> l_result = null;
Node<T> l_list1 = p_linkedList;
Node<T> l_list2 = p_linkedList1;
Node... | 8 |
private void drawOrbit(Subject subject, Coordinate parentPos) {
double currentScale = radiusScale;
if (subject.depth() > 2) {
currentScale = radiusMoonScale;
}
double radius = subject.p.radius * currentScale;
// g.setStroke(dashed);
g.setColor(PATH_COLOR);
... | 1 |
public String getColumnName(int col) {
try {
return viewer.getColumnName(col);
} catch (Exception err) {
return err.toString();
}
} | 1 |
public void mouseClicked(MouseEvent evt) {
if (evt.getSource()==mapimage || evt.getSource()==newsimage){
display();
}
} | 2 |
private ColumnComparator makeSumColumnComparator(Element elSum) throws Exception
{
String type = elSum.getAttribute("type").toLowerCase();
boolean ascending = !(elSum.getAttribute("order").toLowerCase().equals("descending"));
String defaultString = elSum.getAttribute("default");
ArrayList<NumberN... | 6 |
public void run(){
Logger.log("IN run");
Comparable<?>[] splits = null;
try {
splits = initTask.execute();
} catch (FileSystemException e) {
//cannot happen checked file in constructor
// TODO delete
e.printStackTrace();
}
int numberOfReducers = splits.length + 1;
reducerTaskArray = new Reduc... | 8 |
public static List<Sale> formatOutputs(JSONArray results) {
final List<Sale> ret = new ArrayList<Sale>();
for (int i = 0; i < results.length(); i++) {
JSONObject r = null;
if (results.get(i) instanceof JSONObject)
r = (JSONObject) results.get(i);
if (r != null) {
final Sale s = new Sale();
s.s... | 4 |
public void drawRedraw(Graphics2D graphics) {
if (running) {
this.randomPoint.drawPoint(graphics);
if (this.snake1.isWithinLimits() && this.snake1.canPlay()) {
this.snake1.updateMovement();
this.snake1.drawPoints(graphics);
if (this.snake1.interact(randomPoint)) {
randomPoint.setCenter(Po... | 9 |
public static boolean wait(LoopCondition condition, int frequency, int tries) {
tries = Math.max(1, tries + org.powerbot.script.Random.nextInt(-1, 2));
for (int i = 0; i < tries; i++) {
try {
Thread.sleep((long) Math.max(5, (int) ((double) frequency * org.powerbot.script.Random.nextDouble(0.85, 1.5))));
}... | 6 |
public static String stripQuotes(String msg)
{
if (msg.startsWith("\""))
msg = msg.substring(1);
if (msg.substring(msg.length() - 1).equals("\""))
msg = msg.substring(0, msg.length() - 1);
return msg;
} | 2 |
private void foundTrips() {
rank = Rank.THREEOFAKIND;
Card.Rank tripRank = null;
// Find the biggest trips
for (int i = 0; i < ranks.length; i++) {
Card[] value = ranks[i];
if (value == null) continue;
if (numRanks[i] == 3) {
tripRank =... | 7 |
private void createEmptyBoard(int cols, int rows) {
for(int y = 0; y < cols; y++) {
for(int x = 0; x < rows; x++) {
if(y == 0 || x == 0) {
squares[y][x] = SquareType.OUTSIDE;
}else if(y == cols-1 || x == rows-1) {
squares[y][x] = SquareType.OUTSIDE;
}else {
squares[y][x] = SquareType.EMP... | 6 |
public static void testMouFitxa()
{
if ( taulers.size() > 0 )
{
String jugador = llegeixParaula( "Escull un jugador (A, B, cap):" );
EstatCasella fitxa;
if ( jugador.equalsIgnoreCase( "A" ) )
{
fitxa = EstatCasella.JUGADOR_A;
}
else if ( jugador.equalsIgnoreCase( "B" ) )
{
fitxa = Esta... | 5 |
public boolean isSameTree(TreeNode p, TreeNode q) {
if (p == null && q == null)
return true;
if (p == null || q == null)
return false;
return (p.val == q.val && isSameTree(p.left,q.left) && isSameTree(p.right, q.right));
} | 6 |
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == btnMakeAppointments) {
//GOTO make appointments
ViewAppointmentPanel vap = new ViewAppointmentPanel(parent, username);
parent.getContentPane().add(vap);
CardLayout cl = (CardLayout) parent.getContentPane().getLayout();
c... | 8 |
public void actionPerformed(java.awt.event.ActionEvent arg0){
if (bankMode) // dans le cas d'echange avec la banque
{
if (arg0.getSource()==plusM){
deposit = true;
quantiteM=quantiteM + specialization;}
else if (arg0.getSource()==moinsM){
deposit = false;
quantiteM=quantiteM... | 9 |
public void communicate() throws IOException {
new Thread(new Runnable() {
public void run() {
try {
String str = sbr.readLine();
while (str != null) {
System.out.println(str);
str = sbr.readLine();
}
System.err.println("Disconnected by server");
} catch (IOException e) {
... | 4 |
@Override
public boolean retainAll(Collection<?> arg0) {
boolean changed = false;
for(int i = 1; i < mobs.length; i++) {
if(mobs[i] != null) {
if(!arg0.contains(mobs[i])) {
mobs[i] = null;
size--;
changed = true;
}
}
}
return changed;
} | 4 |
@Override
protected void readMessage(InputStream in, int msgLength)
throws IOException {
super.readMessage(in, msgLength);
int pos = 2;
while (pos < msgLength) {
QoS qos = QoS.valueOf(in.read());
addQoS(qos);
pos++;
}
} | 1 |
public void setTraversalMap(int locx, int locy, MazeMap mazeMap) {
int frontM, rightM, leftM;
mazeVal = mazeMap.getMazeVal(locx, locy);
//System.out.format("MazeVal(%d, %d): %x\n", locx, locy, mazeVal);
switch (curDirec) {
case 0:
front = 0;
ri... | 8 |
private void extractAlignedSeqInfo(java.util.List<CigarElement> cigar, byte[] sequence, byte[] qual, SAMRecord aln) {
// read info
isReadReversed = aln.getReadNegativeStrandFlag();
// aligned seq info
Vector<Byte> as = new Vector<Byte>();
Vector<Byte> aq = new Vector<Byte>();
int pos = 0;
for (CigarEle... | 9 |
public static void run() {
IMediaReader mediaReader = ToolFactory.makeReader(inputFilename);
// stipulate that we want BufferedImages created in BGR 24bit color space
mediaReader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);
ScreenShotsManager manager = new ScreenShots... | 1 |
@Override
public void paintComponent(Graphics g) {
GregorianCalendar currentTime = (GregorianCalendar) GregorianCalendar
.getInstance();
hour = currentTime.get(Calendar.HOUR_OF_DAY);
minutes = currentTime.get(Calendar.MINUTE);
seconds = currentTime.get(Calendar.SECOND);
int xcenter = 150, ycenter = 150;
... | 6 |
public static MessageAdaptor wrapMessage(Message message)
throws JMSException {
MessageAdaptor adaptor = null;
if (CameraCaptureRequest.TYPE.equals(message.getJMSType())) {
adaptor = new CameraCaptureRequest();
} else if (CameraCaptureResponse.TYPE.equals(message.getJMSTy... | 4 |
public String bytesToHex(byte[] raw)
{
int length = raw.length;
char[] hex = new char[length * 2];
for(int i = 0; i < length; i++)
{
int value = (raw[i] + 256) % 256;
int highIndex = value >> 4;
int lowIndex = value & 0x0f;
hex[i * 2 + ... | 1 |
public static void main(String[] args) throws FileNotFoundException, IOException{
Scanner scan = new Scanner(System.in);
String file = "ptb-flat.txt";
WordsTree tree = new WordsTree();
boolean on = true;
while(on) {
System.out.println("BEM-VINDO AO EXTRACTDICTIONARY... | 7 |
public void deleteLayerFile(int selectedLayer) {
File layer = new File(workingDir, "Layer" + selectedLayer + ".dat");
File layerColl = new File(workingDir, "Layer" + selectedLayer + "_Collision.dat");
if(layer.exists()) layer.delete();
if(layerColl.exists()) layerColl.delete();
if(Layers >= selectedLayer) {
... | 5 |
public void run() {
String importantInfo[] = {
"Mares eat oats",
"Does eat oats",
"Little lambs eat ivy",
"A kid will eat ivy too"
};
try {
for (int i = 0; i < importantInfo.length; i++) {
... | 2 |
public LinearGradientPaintContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform t,
RenderingHints hints,
... | 6 |
public static int[] insertionSort(int[] array, boolean ascendingOrder) {
if (array != null && array.length > 1) {
for (int i = 1; i < array.length; i++) {
for (int j = i; j >= 1; j--) {
if (Utils.compareOrder(array[j], array[j - 1], ascendingOrder)) {
Utils.swap(array, j, j - 1);
} else {
... | 5 |
public ClusterNode getLastNode() {
return this.lastNode;
} | 0 |
private boolean isEndOfLine(int c) throws IOException {
// check if we have \r\n...
if (c == '\r') {
if (in.lookAhead() == '\n') {
// note: does not change c outside of this method !!
c = in.read();
}
}
return (c == '\n');
} | 2 |
public static boolean[][] rectangle() {
boolean patron[][] = new boolean[maxFil][maxCol];
for (int f=0; f<maxFil; f++) {
for (int c=0; c<maxCol; c++) {
if (f >= maxFil/4 && f <= 3*maxFil/4 &&
c >= maxCol/4 && c <= 3*maxCol/4) {
patron[f][c] = true;
} else {
patron[f][c] = false;
... | 6 |
public void generateUnit(Dimension size) {
unit.value = (size.width < size.height ? size.width / (FIELD_DIMENSION.width + 2) : size.height / (FIELD_DIMENSION.height + 2));
} | 1 |
public Type checkType(TypeMap tm)
{
Type t = new Type();
t.typeid = Type.TypeEnum.t_error;
Type tmp = e.checkType(tm);
if(tmp.OK())
{
if(tmp.typeid == Type.TypeEnum.t_pair)
{
t.typeid = tmp.t1.typeid;
}
else
{
if(Type.isDebug)
{
System.out.println("TypeError! fst: "+tmp.typeid... | 3 |
static double prim(double[][] mAdy,int n){
boolean[] v=new boolean[n];
double[] a=new double[n];
PriorityQueue<double[]> cola=new PriorityQueue<double[]>(n,new Comparator<double[]>(){
public int compare(double[] o1,double[] o2){
if(o1[0]<o2[0])return -1;
if(o1[0]>o2[0])return 1;
if(o1[1]<o2[1])retu... | 9 |
@WebMethod(operationName = "ReadSupplier")
public ArrayList<Supplier> ReadSupplier(@WebParam(name = "sup_id") String sup_id) {
Supplier sup = new Supplier();
ArrayList<Supplier> sups = new ArrayList<Supplier>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
... | 3 |
@Override
public SpeedVector getSpeedVector(Movable m) {
SpeedVector currentSpeedVector, possibleSpeedVector;
currentSpeedVector = m.getSpeedVector();
possibleSpeedVector = super.getSpeedVector(m);
int nbTries = 10;
while (true) {
nbTries--;
if ((possibleSpeedVector.getDirection().getX() == currentSp... | 8 |
public String longestCommonPrefix(String[] strs) {
if (strs == null || strs.length == 0) {
return "";
} else if (strs.length == 1) {
return strs[0];
}
String prefix = "";
int length = Integer.MAX_VALUE;
for (String s : strs) {
length = Math.min(s.length(), length);
}
for (int i = 0; i < length;... | 8 |
public ArrayList<Day> getDays()
{
return days;
} | 0 |
public boolean actionSmelt(Actor actor, Smelter smelter) {
int success = 0 ;
if (actor.traits.test(HARD_LABOUR, 10, 1)) success++ ;
if (! actor.traits.test(CHEMISTRY, 5, 1)) success-- ;
if (actor.traits.test(GEOPHYSICS, 15, 1)) success++ ;
if (success <= 0) return false ;
final Item sample ... | 5 |
public static void DoTurn(PlanetWars pw) {
//notice that a PlanetWars object called pw is passed as a parameter which you could use
//if you want to know what this object does, then read PlanetWars.java
//create a source planet, if you want to know what this object does, then read Planet.java
Planet... | 2 |
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "CipherData")
public JAXBElement<CipherDataType> createCipherData(CipherDataType value) {
return new JAXBElement<CipherDataType>(_CipherData_QNAME, CipherDataType.class, null, value);
} | 0 |
public Object getValue(int index) {
return params.get(index);
} | 0 |
public static double[][] scale( double[][] mat, double fac )
{
int m = mat.length;
int n = mat[0].length;
double[][] res = new double[m][];
for ( int i = 0; i < m; ++i )
{
res[i] = new double[n];
for ( int j = 0; j < n; ++j )
res[i][j] = mat[i][j] * fac;
}
return(res);
} | 2 |
public void run()
{
RowDto<PixelDto> pixelRowDto;
RowDto<HeightDto> heightRowDto;
while (running.get() || ImageStorage.pixelRowHasNext())
{
pixelRowDto = ImageStorage.getPixelRow();
if (pixelRowDto != null)
{
heightRowDto = new RowDto<HeightDto>();
while (pixelRowDto.hasMore())
{
pr... | 4 |
public void actionPerformed(ActionEvent event) {
if (event.getSource() == pTextField) {
String text = String.format("%s", event.getActionCommand());
System.out.println("price == " + text);
p = Double.parseDouble(text);
}
if (event.getSource() == dpTextField) {
String text = event.getActionC... | 6 |
public void update(Point p) {
((GeneralPath) shape).lineTo(p.x, p.y);
dollar.pointerDragged(p.x, p.y);
canvas.repaint();
} | 0 |
@Raw @Model
private void setCurrentHitPoints(int hitPoints) {
int oldHP = this.currentHitPoints;
this.currentHitPoints = (hitPoints <= 0) ? 0 : Math.min(hitPoints, getMaximumHitPoints());
if (hitPoints <= 0 && oldHP > hitPoints && this.getWorld() != null && this.getWorld().getActiveWorm() == this) //so this does... | 5 |
public String getFeetype() {
return Feetype;
} | 0 |
public void renderSprite(int xp, int yp, Sprite sprite, boolean fixed) {
if (fixed) {
xp -= xOffset;
yp -= yOffset;
}
for (int y = 0; y < sprite.getHeight(); y++) {
int ya = y + yp;
for (int x = 0; x < sprite.getWidth(); x++) {
int xa = x + xp;
if (xa < 0 || xa >= width || ya < 0 || ya >= heig... | 7 |
public ThreadPool(int numThreads) {
queue = new LinkedBlockingQueue<Runnable>();
threads = new Thread[numThreads];
int i = 0;
for (Thread t : threads) {
i++;
t = new Worker("Thread "+i);
t.start();
}
} | 1 |
public void putBlock(Block block){
score++;
statusBar.setText("SCORE = " + String.valueOf(score));
RestartButton.setText("Restart");
//int [][] theBlock = block.getBlock();
//int k = (int)(Math.random() * MAX_COL);
BlockPosX = 5;
BlockPosY = 0;
int posX = 5;
int posY = 0;
BlockInControl = block;
int x = 0;... | 5 |
XLightWebResponse(
final HttpClient client,
final BOSHClientConfig cfg,
final CMSessionParams params,
final AbstractBody request) {
super();
IFutureResponse futureVal;
try {
String xml = request.toXML();
byte[] data = xml.g... | 8 |
public static final Cycle getCycleCorrespondant(String nomCycle) throws Exception {
Cycle cycle = null;
if (nomCycle.equals("2012-2014")) {
cycle = new Cycle2012_2014();
} else {
throw new Exception("Cycle " + nomCycle + " n'est pas supporté.");
}
return c... | 1 |
public final int getNextCharWithBoundChecks() {
if (this.currentPosition >= this.eofPosition) {
return -1;
}
this.currentCharacter = this.source[this.currentPosition++];
if (this.currentPosition >= this.eofPosition) {
this.unicodeAsBackSlash = false;
if (this.withoutUnicodePtr != 0) {
unicodeStore();
... | 7 |
public synchronized Entity getEntity(int id) {
for (Entity e : getEntities()) {
if (e.getId() == id)
return e;
}
return null;
} | 2 |
private static final void pad2(int value, StringBuilder buffer) {
if (value < 10) {
buffer.append('0');
}
buffer.append(value);
} | 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.