text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
protected void calculateTrackRect() {
super.calculateTrackRect();
ColorPickerPanel cp = this.colorPicker.getColorPanel();
int size = Math.min(ColorPickerPanel.MAX_SIZE, Math.min(cp.getWidth(), cp.getHeight()));
int max = this.slider.getHeight() - (this.ARROW_HALF * 2) - 2;
... | 1 |
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 visitFrame(
final int type,
final int nLocal,
final Object[] local,
final int nStack,
final Object[] stack)
{
instructions.add(new FrameNode(type, nLocal, local == null
? null
: getLabelNodes(local), nStack, stack == null
... | 2 |
public void setBoolean(TBoolean node)
{
if(this._boolean_ != null)
{
this._boolean_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this... | 3 |
public boolean isEmptySpace()
{
int i = 0, j = 0;
for(i = 0; i < 9; i++)
{
for(j = 0; j < 9; j++)
{
if(entries[i][j].getText().equals(""))
{
System.out.println("isEmptySpace() returned false at i: " + i + " j: "+j);
return false;
}
}
}
return true;
} | 3 |
private void closeResource(AutoCloseable res){
try {
if (res != null){
res.close();
}
} catch (Exception e) {
e.printStackTrace();
}
} | 2 |
public static void main(String args[]){
Scanner in = new Scanner(System.in);
System.out.print("The cost of a new car:");
double cost = in.nextDouble();
System.out.print("The estimated miles driven per year:");
double miles = in.nextDouble();
System.out.print("The estimate... | 0 |
protected void addPredictionIntervals() {
int maxNum;
int num;
int i;
int n;
FastVector preds;
FastVector atts;
Instances data;
Instance inst;
Instance newInst;
double[] values;
double[][] predInt;
// determine the maximum number of intervals
maxNum = 0;
... | 7 |
public static byte[] decompression(byte[] fluxADecompresser){
byte[] aRetourner = null;
try{
GestionFichier.fluxEnFichier("fichierTemporaire/fichierADecompresserTemporaire.gz",fluxADecompresser);
Runtime.getRuntime().exec("gzip -d fichierTemporaire/fichierADecompresserTemporaire.gz");
//attente de d�compre... | 2 |
private void jTextFieldCouleurLibelleKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldCouleurLibelleKeyPressed
if ((this.jTextFieldCouleurLibelle.getText().equals("")))
{
this.jButtonCouleurValider.setEnabled(false);
}
else
{
this.jButt... | 1 |
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... | 5 |
public ArrayList<Polynomial> factor(int maxdegree) throws Exception {
// zero
if (coeff.length == 0) {
ArrayList<Polynomial> factors = new ArrayList<Polynomial>();
factors.add(zero());
return factors;
}
// constants
if (coeff.length == 1) ... | 5 |
public Game.PlayerType getType() {
if (this instanceof HumanPlayer) {
return Game.PlayerType.HUMAN;
}
if (this instanceof ComputerPlayer) {
if (this instanceof EasyComputerPlayer) {
return Game.PlayerType.COMPUTER_EASY;
}
if (this... | 5 |
@Override
public void requestInitialized(ServletRequestEvent sre) {
ServletContext context = sre.getServletContext();
ServletRequest request = sre.getServletRequest();
synchronized (context){
int tempDay, tempMonth;
Date date = new Date();
Calendar calendar = GregorianC... | 6 |
@Override
public void sendUsageImpl(CommandSender sender) {
if (!(sender instanceof Player)) return;
sender.sendMessage(EdgeCore.usageColor + "/account info");
sender.sendMessage(EdgeCore.usageColor + "/account apply");
sender.sendMessage(EdgeCore.usageColor + "/account deactivate");
sender.sendMessage(Ed... | 3 |
@Override
public double solve(int[][] matrix, double[] profitTable, int[] teamTable) {
//Run the Cplex solver
try {
//Create the IloCplex model
IloCplex cplex = new IloCplex();
//Decision variable - x_p
IloNumVar[] x = new IloNumVar[matrix[0].length];
for(int p = 0; p < x.length; p++)
x[p] = cp... | 9 |
@Override
public String next() {
if(!hasNext) return null;
String nurl = "";
boolean withBreak = false;
// Von rechts nach links wird erhöht
for(int i = size-1; i >= 0; i--) {
// Es wird nur erhöht, wenn die Zahl noch kleiner ist als der Endwert
if(loops[i] < tagRange[i].getMax()) {
... | 5 |
@Override
public Map findRecordById(String table, String pkField, Object keyValue,
boolean closeConnection) throws SQLException, Exception {
Statement statement = null;
ResultSet resultSet = null;
ResultSetMetaData metaData = null;
final Map record = new HashMap();
... | 7 |
private boolean isInPile(Pile p,Card c)
{
int pileSize=p.getNumCards();
Card r;
for(int i=0;i<pileSize;i++)
{
r=p.getCard(i);
if((r.getSuit()==c.getSuit())&&(r.getFaceValue()==c.getFaceValue()))
{
return true;
}
}
return false;
} | 3 |
@Deprecated
public boolean createTable(String query) {
Statement statement = null;
try {
if (query == null || query.equals("")) {
this.writeError("Could not create table: query is empty or null.", true);
return false;
}
statement = connection.createStatement();
statement.execute(query);
... | 3 |
public synchronized HashMap<String, String> startTestLocal(String userKey, String testId) {
HashMap<String, String> res = new HashMap<String, String>();
String url = this.urlManager.testStartLocal(Constants.APP_KEY, userKey, testId);
String responseCode = null;
String errorMessage = nul... | 2 |
public void describeStatus(Description d) {
if (pilot != null && pilot.mind.rootBehaviour() != null) {
pilot.mind.rootBehaviour().describeBehaviour(d) ;
}
else if (motion.target() != null) {
if (motion.target() == aboard()) d.append("Aboard ") ;
else d.append("Heading for ") ;
d.appe... | 4 |
public static boolean pathEquals(String path1, String path2) {
return cleanPath(path1).equals(cleanPath(path2));
} | 0 |
@Override
public Iterator<String[]> iterator() {
Iterator<String[]> it = new Iterator<String[]>() {
private String currentLine = null;
private String[] values = null;
@Override
public boolean hasNext() {
try {
currentLine = reader.readLine();
if (currentLine == n... | 5 |
protected void addObjectValue(Object obj, String fieldname, Object value,
Object template)
{
if (value != null && !value.equals(template))
{
if (fieldname != null && obj instanceof Map)
{
((Map) obj).put(fieldname, value);
}
else if (fieldname != null && fieldname.length() > 0)
{
setField... | 7 |
public int getX() { return x; } | 0 |
public boolean isPalindrome(String s) {
s=s.toLowerCase();
int i=0,start=-1,end=-1;
boolean flag=true;
ArrayList<Character> sn = new ArrayList<Character>();
for(i=0;i<s.length();i++)
{
if((s.charAt(i)>='a'&&s.charAt(i)<='z')||(s.charAt(i)>='0'&&s.charAt(i)... | 7 |
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ChangeEvent<?> that = (ChangeEvent<?>) o;
if (!newValue.equals(that.newValue)) {
... | 8 |
static LinkedListNode removeMid(LinkedListNode n) {
LinkedListNode fast, slow;
fast = n;
slow = n;
while (fast != null && fast.next != null) {
fast = fast.next.next;
slow = slow.next;
}
slow.v = slow.next.v;
slow.next = slow.next.next;
... | 2 |
@Override
public void detectRelationships(Obituary obit) throws Exception {
List<List<Term>> sentences = extractor.tagEntities(obit);
for (List<Term> sentence : sentences) {
sentence = EntityUtils.combineEntities(sentence);
tagSentence(sentence);
List<String> lines = new ArrayList<String>();
List<Term>... | 9 |
private void load() throws FileNotFoundException {
File file = new File("test.txt");
//Check if the file already exists, if not throw exception
if (!file.isFile()) {
throw new FileNotFoundException();
}
Scanner scan = new Scanner(file);
try {
String cfg = "";
while (scan.hasNext()) {
... | 6 |
public Object buscar(Integer busca) {
String sql = "SELECT * FROM PEDIDO WHERE idPedido = ?";
try {
conn = GerenciaConexaoBD.getInstance().getConnection();
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setInt(1, busca);
ResultSet rs = stmt.executeQuery();
Reserva reserva = new Reserva()... | 2 |
public static boolean legitStartLoc( int pointNum, int playerColor ) {
if ( ! legitPlayerColor(playerColor)) {
throw new IllegalArgumentException("bad playerColor '" + playerColor + "'");
}
if ( (1 <= pointNum) && (pointNum <= howManyPoints) ) {
return true;
} els... | 7 |
public void update(Observable arg, Object arg0) {
if (model.getPhase() == IMMOVABLEPHASE) {
for (int i=0; i<buttons.length; i++){
buttons[i].setEnabled(false);
}
} else {
for (int i=0; i<buttons.length; i++){
buttons[i].setEnabled(true);
}
this.requestFocus();
for (int i = 0; i < butto... | 7 |
public static Team generateTeam(String teamName){
ArrayList<Player> teamRoster = new ArrayList<Player>();
//Create the goalies
for (int i = 0; i < 2; i++){
Player p = Helper.generatePlayer(teamName);
p.setPosition(POSITION.values()[0]);
teamRoster.add(p);
}
//Create the centers
for (int i = 0; i... | 5 |
public double cos(int a){
//normalizing
if(a>360){
a %= 360;
}else if(a<0){
a %= 360;
a += 360;
}
//return
if(a <= 90){
return cos[a];
}else if(a <= 180){
return -cos[180 - a];
}else if(a <= 270){
return -cos[a - 180];
}else{
return cos[360 - a];
}
} | 5 |
public static void main(String[] args) throws IOException {
InitialSolutionGreedy solucaoinicial = new InitialSolutionGreedy();
solucaoinicial.leituraArquivoCons();
System.out.println("Nome Arquivo: "+solucaoinicial.getNomearquivo());
Solucao inicial = solucaoinicial.InitialGreedySolutio... | 5 |
@Override
public void keyReleased(KeyEvent key) {
int keyCode = key.getKeyCode();
if (keyCode == KeyEvent.VK_LEFT) {
player.setLeft(false);
player.setDownLeft(false);
player.setUpLeft(false);
}
if (keyCode == KeyEvent.VK_RIGHT) {
player.setRight(false);
player.setUpRight(false);
player.setDow... | 5 |
public static void main(String[] args) {
int digitCount = 0, letterCount = 0, lcCount = 0, ucCount = 0, wsCount = 0;
for (int i = 0; i < 0x10FFFF; i++) {
if (Character.isDigit(i)) {
digitCount++;
}
if (Character.isLetter(i)) {
letterCount++;
}
if (Character.isLowerCase(i)) {
lcCount++;
... | 6 |
public void startSQL() {
try {
InputStream in = this.getClass().getResourceAsStream("/sols/Util/jdbc.properties");
Properties pp = new Properties();
pp.load(in);
url = pp.getProperty("jdbc.url");
user = pp.getProperty("jdbc.username");
pas... | 1 |
public void encrypt(String file, String encrypted_file, int size) throws Exception {
FileInputStream input_file = new FileInputStream(file);
FileOutputStream PGP_file = new FileOutputStream(encrypted_file, true);
SecureRandom rnd = new SecureRandom();
//session key k, must be 1<k<p-1
... | 3 |
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 fe... | 6 |
public RoomList getRoomList(String asLastModified) {
String lsParam = "";
if (UtilityMethods.isValidString(asLastModified)) {
lsParam += "?last_modified=" + asLastModified;
}
return get(RoomList.class, REST_URL_ROOMS + lsParam);
} | 1 |
public Icon getIcon(File f) {
String extension = Utils.getExtension(f);
Icon icon = null;
if (extension != null) {
if (extension.equals(Utils.jpeg)) {
icon = jpegIcon;
} else if (extension.equals(Utils.jpg)) {
icon = jpgIcon;
... | 7 |
public void visitMaxs(final int maxStack, final int maxLocals) {
buf.setLength(0);
buf.append(tab2).append("MAXSTACK = ").append(maxStack).append('\n');
text.add(buf.toString());
buf.setLength(0);
buf.append(tab2).append("MAXLOCALS = ").append(maxLocals).append('\n');
te... | 1 |
public void calculateSpeed(){
if(currentSpeed>blockSpeedLimit && blockSpeedLimit != 0){
currentSpeed = blockSpeedLimit;
}else{
currentSpeed = currentSpeed + (currentAcceleration * deltaT);
}
if(currentSpeed > 19.44) //Max speed can't
current... | 4 |
public RegisterEEA eea(Double a, Double b) {
ArrayList<RegisterEEA> eeaList = new ArrayList<RegisterEEA>();
RegisterEEA r = new RegisterEEA(a, b);
eeaList.add(r);
while (r.a != 1 && r.b != 0) {
r = new RegisterEEA(r);
eeaList.add(r);
}
for (int i =... | 4 |
public static void main(String[] args)
{
Config.initLogs();
// String exp = "B1 24 + C2 (2.6 67) B3 G4(F1 + H2)L3(D1- V2)(S3 / S4)";
System.out.println("Enter command : ");
System.out.println(" go - for bagining calculation");
System.out.println(" exit - for exit ");
... | 5 |
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
for (int i = 0; i < n; i++) {
String[] in = br.readLine().split(" ");
int row = Integer.parseInt(in[0]);
int col = Integer.parseIn... | 6 |
public HashSet<Node> findArticPoints(Node argNode, int depth,Node fromNode){
// #Gross
HashSet<Node> artPoints = new HashSet<Node>();
// not sure if i should be doing this
for(Node n:nodes){
n.setVisited(false);
}
Stack<StackNode> stack = new Stack<StackNode>();
stack.push(new StackNode(argNode, dep... | 9 |
public void setForegroundCorpus(Documents docs) {
Counter scores = new Counter();
termScore = new HashMap<String, Double>();
double total = 0;
for (Document doc : docs.documents)
{
total += 1;
for (String term:doc.getUniques()) {
scores.add(term);
}
}
for (Map.Entry<String, SingleCo... | 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());
... | 6 |
private ContactListVO addSearchMessageToVO(ContactListVO contactListVO, Locale locale, String actionMessageKey, Object[] args) {
if (StringUtils.isEmpty(actionMessageKey)) {
return contactListVO;
}
contactListVO.setSearchMessage(messageSource.getMessage(actionMessageKey, args, null,... | 1 |
public static void main(String[] args) {
/*Get user input, .xml file name and if graphics are desired,
* read file and save to provide input to robot*/
VirtualHouse cleanSweepInput = new VirtualHouse();
/*Setup lists and private variable to get robot ready to roll */
CleanSweepRobot robo... | 1 |
private HashSet<SearchNode> constructDeletedList() {
HashSet<SearchNode> deletedList = new HashSet<SearchNode>();
HashSet<SearchNode> tempList = new HashSet<SearchNode>();
// First process all the nodes starting from the ones within open list
for (SearchNode openNode : m_openLis... | 8 |
static final void method2158(byte i) {
anInt6256++;
int i_0_ = 0;
if (BitmapTable.aClass348_Sub51_3959 != null)
i_0_ = ((Class348_Sub51) BitmapTable.aClass348_Sub51_3959)
.aClass239_Sub23_7231.method1818(-32350);
if (i == 56) {
if (i_0_ == 2) {
int i_1_ = ((Class272.anInt3473 ^ 0xffffffff) >= -... | 8 |
@Override
public RouteLength getLength()
{
RouteLength totalLength = new RouteLength(0);
for (Connection currentConnection : connections)
{
totalLength = totalLength.plus(currentConnection.getLength());
}
return totalLength;
} | 1 |
private static void setMethodProperties(com.swemel.sevenzip.compression.lzma.Encoder encoder, long inSizeForReduce, LZMACoderInfo info) {
boolean tryReduce = false;
int dictionarySize = 1 << 24;
int reducedDictionarySize = 1 << 10;
if (inSizeForReduce != 0) {
for (; ; ) {
... | 7 |
@Override
public void removeReceiveDataListener(ReceiveDataOnServerListener listener) {
if (receiveDataOnServerListenerList != null) {
receiveDataOnServerListenerList.remove(ReceiveDataOnServerListener.class, listener);
}
} | 1 |
@RequestMapping(value = "/event-branch-leader-list/{eventBranchId}", method = RequestMethod.GET)
@ResponseBody
public BranchLeaderListResponse branchLeaderList(
@PathVariable(value = "eventBranchId") final String eventBranchIdStr
) {
Boolean success = true;
String errorMessage = ... | 1 |
private void jTextFieldLogFileNameFocusLost(java.awt.event.FocusEvent evt)//GEN-FIRST:event_jTextFieldLogFileNameFocusLost
{//GEN-HEADEREND:event_jTextFieldLogFileNameFocusLost
// Remove old value, but save the index for the new value
int index = jListTemplateLogFiles.getSelectedIndex();
Log editedLog = Prefere... | 8 |
public void loadGame() {
File file = new File("Data/SaveFile.sav");
FileInputStream fis = null;
BufferedInputStream bis = null;
DataInputStream dis = null;
try {
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
dis = new Dat... | 6 |
private Set<Set<String>> getSubsetsOfSize(Set<String> prefixSet, Set<String> set, int size){
if(prefixSet.size()==0){
if(size<=0){
return null;
}
if(size>set.size()){
return null;
}
}
Set<Set<String>> subsets = new H... | 6 |
public Select(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "autofocus":
autofocus = Autofocus.parse(this, v);
break;
case "disabled":
disabled = Disabled.parse... | 8 |
public String getName() {
return name;
} | 0 |
public boolean removeURL(WebURL webUrl) {
synchronized (mutex) {
try {
DatabaseEntry key = getDatabaseEntryKey(webUrl);
Cursor cursor = null;
OperationStatus result;
DatabaseEntry value = new DatabaseEntry();
Transaction txn = env.beginTransaction(null, null);
try {
cursor = urlsDB... | 7 |
public Expr ShiftExpr() throws ParseException {
Token tok;
Expr e, er;
e = AddExpr();
label_10:
while (true) {
switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
case 175:
case 176:
break;
default:
... | 7 |
public void onUpdate(long tickTime) {
super.onUpdate(tickTime);
if (speedy && tickTime % 2 == 0) {
updateFrame();
}
else if (tickTime % 6 == 0) {
updateFrame();
}
if (tickTime % 5 == 0)
updateSurroundings();
} | 4 |
private void train(List <Example> examples) {
classes = uniqueOutputValues(examples);
classProbabilityTable = new HashMap <String, Double> ();
categoricalCPT =
new HashMap <String, List <Map <String, Double> > > ();
continuousCPT =
new HashMap <String, List <Pair <Double, Double> > > ();... | 5 |
public void insert(Comparable item) {
current = parent = grand = header;
nullNode.element = item;
while (current.element.compareTo(item) != 0) {
great = grand;
grand = parent;
parent = current;
current = item.compareTo(current.element) < 0 ? current.left
: current.right;
// Check if two red ... | 6 |
@Override
public HashMap<Integer, ArrayList<SamplePoint>> SpatialTemporalWindowQuery(long midTime, long tRadius, double longitude, double latitude, double sRadius) {
// TODO Auto-generated method stub
//ArrayList<QueryResultDataStruc> trajPoints=new ArrayList<QueryResultDataStruc>();
... | 9 |
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 |
public static int minkowskiDist(int color1, int color2, double k) {
double p = k;
// use p >= 1 we have the Minkowski inequality
// careful : the higher the power, the longer the wait
double dRed = Math.abs( ((color1 & RED_MASK) >> 16) - ((color2 & RED_MASK) >> 16));
double dGr... | 0 |
@SuppressWarnings("unchecked")
private boolean haveSuchUser(String pernr) {
List<Map<String, String>> userList = new ArrayList<Map<String,String>>();
try {
if (pernr.contains("|")) {
String pernrs[] = pernr.split("[|]");
for (String p : pernrs) {
userList = new ObjectMapper().readValue(service.getU... | 6 |
public int getWidth() {
return tiles.length;
} | 0 |
public Historialclinico getHistorialClinicoidHistorialClinico() {
return historialClinicoidHistorialClinico;
} | 0 |
*@param password
**/
public boolean comprobarMiembro(String nick, String password){
for(beansMiembro miembro : miembros){
if(miembro.getNick().equals(nick) && miembro.getPassword().equals(password)){
setMiembro(miembro);
return true;
}else{
resultado = comprobarInterior(miembro, nick, password);
... | 4 |
@Override
public void update(long deltaMs) {
if(getTargetedActor() == null)
checkEnemies();
target();
} | 1 |
private void showReport(){
String reportText = PreparingNewAlgos.compileAlgorythm(fieldCommandLine.getText());
try{
if (reportText == null)
throw new Exception();
if(reportText.equals("Done")){
JOptionPane.showMessageDialog(this,
... | 4 |
private void simplePush(Type type, Frame frame) {
frame.push(type);
if (type.getSize() == 2)
frame.push(Type.TOP);
} | 1 |
public float getFloat(){
try{
return Float.parseFloat( value );
}
catch( NumberFormatException ex ){
throw new XException( ex );
}
} | 1 |
private static boolean isWindowInScreenBounds(Point location, Point size) {
Point myLocation = new Point(location);
if (!isLocationInScreenBounds(myLocation)) {
return false;
}
myLocation.translate(size.x, 0);
if (!isLocationInScreenBounds(myLocation)) {
return false;
}
myLocation.translate(0, s... | 4 |
public void service() {
Table table = Table.getTableInstance();
while(true) {
Socket socket = null;
try {
socket = serverSocket.accept();
System.out.println("New player accepted-->" + socket.getInetAddress()+":"+socket.getPort());
table.addPlayer(new Player(table.inChip, socket));
} catch (I... | 4 |
public void display() {
for (int i = 0; i < width; i++) {
// draw the north edge
for (int j = 0; j < length; j++) {
System.out.print((maze[j][i] & 1) == 0 ? "[][]" : "[] ");
}
System.out.println("[]");
// draw the west edge
for (int j = 0; j < length; j++) {
System.out.print((maze[j][i] & 8... | 6 |
public static MagnetLink createFromURI(String uri) throws MalformedURLException, UnsupportedEncodingException, SocketException{
byte []hashInfo;
byte []peerID;
String name;
String udpTracker = null;
String httpTracker = null;
if(uri.startsWith("magnet:?")){
//build search:
//TODO: some extra tracke... | 9 |
public void run() {
logger.finer("Receiving packets...");
isReceiving = true;
while(isReceiving) {
byte[] bytes = new byte[Packet.MAXIMUM_PACKET_SIZE];
DatagramPacket datagramPacket = new DatagramPacket(bytes, bytes.length);
try {
socket.receive(datagramPacket);
try {
Packet packet = Packet.... | 4 |
public boolean equals(Object o)
{
if(o==null)
return false;
if(!(o instanceof Gun))
return false;
if(bulletsRemaining!=((Gun) o).getBulletsRemaining())
return false;
if(maxBullets!=((Gun) o).getMaxBullets())
return false;
if(model.equals(((Gun) o).getModel()))
return true;
return false;
... | 5 |
public void actionPerformed(ActionEvent e){
if(e.getSource() == cancel){
reset();
} else if (e.getSource() == next){
if(numNext == 0)
createNewMatrixB();
else if(numNext ==1){
try{
createNewMatrixC();
} catch(NumberFormatException exception) {
JOptionPane.showMessageDialog(null, "Inv... | 6 |
public String toString() {
return super.toString();
} | 0 |
public POSFrame(Controller controller)
{
this.controller = controller;
orderList = controller.getOrderList();
connectionButton = new JButton();
connectionButton.setForeground(Color.BLUE);
failButton = new JButton();
failButton.setForeground(Color.RED);
idLabel = new JLabel("ID:");
idInputField = new ... | 8 |
@Test
public void testValorTotalProduto() {
try {
Assert.assertEquals(8990f, facade.getValorTotalProduto(1), 0.1);
} catch (FacadeException e) {
Assert.fail(e.getMessage());
}
Produto p5 = new Produto(5,"Smartphone Samsung Galaxy Ace Preto, Desbloqueado Vivo, GSM, Android, C‚mera de 5MP, Tela Touchscreen... | 8 |
@Test
public void testCompleteGraph()
{
final DCRGraph graph = new DCRGraph(0.01, 0.3, PInSampler.MEAN);
final List<Node> nodes = new ArrayList<Node>(100);
final List<Edge> expectedEdges = new ArrayList<Edge>(100 * 100);
final OrdinaryCluster fstCl = new OrdinaryCluster(graph, 0.5);
fstCl.setGroundTruthInde... | 5 |
public static void clearTextures() {
Rasterizer.textureStore = null;
for (int i = 0; i < 50; i++) {
Rasterizer.textureCache[i] = null;
}
} | 1 |
public List<String> getCitedPapers(int id) {
List<String> list = new ArrayList<>();
String query = "select citedids from citedlist where paperid="
+ id;
ResultSet rsSet = null;
rsSet = sqLconnection.Query(query);
try {
while (rsSet.next()) {
String citedlist = rsSet.getString("citedids");
list ... | 2 |
@Override
public TIPO_OBJETO set(TIPO_OBJETO oBean) throws Exception {
Class<TIPO_OBJETO> tipo = (Class<TIPO_OBJETO>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
Method metodo_getId = tipo.getMethod("getId");
Method metodo_setId = tipo.getMethod("setI... | 8 |
private Item getNextPotionLevel()
{
switch (potionLevel)
{
case 1:
return Item.superPotionl2;
case 2:
return Item.superPotionl3;
case 3:
return Item.superPotionl4;
}
return null;
} | 3 |
public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... | 7 |
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
int posX = Mouse.getX();
int posY = Mouse.getY();
introPhoto.draw();
buttonPlay.draw(795, 450);
buttonCreate.draw(795, 510);
buttonCredits.draw(795, 570);
exitGame.draw(1110, 5);
iris.draw(297 + Mouse.getX() * 13 / 120... | 6 |
static double incompleteBetaFraction2(double a, double b, double x) throws ArithmeticException {
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... | 7 |
private TimeManager()
{
} | 0 |
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.