text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void addAndRemoveModels() {
boolean changed=false;
for (int i = 0; i < models.size(); i++) {
if (models.get(i).getIsNoNeedMore()) {
if (!models.get(i).getIsComplex())
explode(models.get(i).getCenter(), models.get(i).getMaxWidth() * 10, models.get... | 5 |
public void removePlayer(Player p ){
if(blau.contains(p)){
blau.remove(p);
}
if(rot.contains(p)){
rot.remove(p);
}
if(grün.contains(p)){
grün.remove(p);
}
if(gelb.contains(p)){
gelb.remove(p);
}
} | 4 |
public static double logLikelihoodScore(ICTClassifier<Double, CTDiscreteNode> model, int nodeIndex,
Collection<ITrajectory<Double>> dataset,
ILearningAlgorithm<Double, CTDiscreteNode> paramsLearningAlg,
boolean dimensionPenalty) throws RuntimeException {
if( dataset == null)
throw new RuntimeException(... | 8 |
private void openSockets() {
boolean requestSocketOpened = false;
boolean echoSocketOpened = false;
for (int i = 0; i <= SOCKET_OPEN_MAX_ATTEMPTS; i++) {
try {
requestSocket = new DatagramSocket(REQUEST_PORT);
requestSocketOpened = true;
break;
} catch (IOException e) {
U.sleep(150... | 6 |
public static void narrclick() {
// in case no card has been played yet
if ((display[0] == 0 || display[0] == 13) && newhand[0] >= 1) {
newhand[0]--;
display[0] = 13;
display[1]++;
}
// in case another card has been played
else if (display[0] != 0 && newhand[0] >= 1) {
newhand[0]--;
display[1]+... | 5 |
private String getTopType(int pos) throws BadBytecode {
Frame frame = getFrame(pos);
if (frame == null)
return null;
CtClass clazz = frame.peek().getCtClass();
return clazz != null ? Descriptor.toJvmName(clazz) : null;
} | 2 |
public void mousePressed(MouseEvent e) {
Mappable mappable=map.getMapObjectAt(e.getX(), e.getY());
setSelected(mappable);
boolean ctrlDown=(e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) !=0;
boolean altDown=(e.getModifiersEx() & InputEvent.ALT_DOWN_MASK) !=0;
if(mappable!=null && SwingUtilities.isRigh... | 8 |
Object unpack(Info vi, Buffer opb){
int acc=0;
InfoResidue0 info=new InfoResidue0();
info.begin=opb.read(24);
info.end=opb.read(24);
info.grouping=opb.read(24)+1;
info.partitions=opb.read(6)+1;
info.groupbook=opb.read(8);
for(int j=0; j<info.partitions; j++){
int cascade=opb.read(... | 6 |
private void knightBottomRightPossibleMove(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if((x1 >= 0 && y1 >= 1) && (x1 <= 5 && y1 < maxHeight))
{
if(board.getChessBoardSquare(x1+2, y1-1).getPiece().getPieceType() != board.getBlankPiece().getPieceTy... | 6 |
public void SQLExceptionInterpreter(SQLException e) {
if (gui.debug) {
System.out.println(e.getErrorCode());
e.printStackTrace();
}
switch (e.getErrorCode()) {
case 2627:
gui.setState("double PRIMARY KEY");
break;
case 515:
gui.setState("Null as PRIMARY KEY");
break;
default:
new ErrorD... | 3 |
public String getPassword() {
return password;
} | 0 |
public boolean isDiagonal(){
boolean test = true;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
if(i!=j && this.matrix[i][j]!=0.0D)test = false;
}
}
return test;
} | 4 |
@Override
public synchronized void redo() throws CannotRedoException {
if (!canRedo())
return;
AbstractDocument.DefaultDocumentEvent lastRedo = null;
AbstractDocument.DefaultDocumentEvent nextRedo;
UndoableEdit ue;
while((ue = super.editToBeRedone()) != null) {
if (!canRedo()) {
break;
}
i... | 8 |
private void vouch (String filename, String certname) throws IOException, GeneralSecurityException{
//create a read-only copy of the file
File readOnlyCopy = new File(filename);
readOnlyCopy.setWritable(false);
String privkeyloc = null;
//adapted from http://docs.oracle.com/javase/tutorial/displayCode.html... | 3 |
public List<IngredientRecipe> getPotentialIngredientList(State state, Domain domain, IngredientRecipe tlIngredient) {
List<IngredientRecipe> ingredients = new ArrayList<IngredientRecipe>();
Collection<IngredientRecipe> allIngredients = this.allIngredients.values();
Set<String> necessaryTraits = tlIngredient.getNe... | 9 |
@SuppressWarnings("unchecked")
static <T> WatchEvent<T> cast(WatchEvent<?> event) {
return (WatchEvent<T>)event;
} | 1 |
public SimpleList<String> minaXMLStructure (){
try {
String path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path
+ "/xml/papabuilding.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuil... | 9 |
private void fill(char[][] board, int i, int j) {
int row = board.length;
int col = board[0].length;
if (i < 0 || i >= row || j < 0 || j >= col || board[i][j] != 'O') {
return;
}
//add, the number make up by (curRow * col + curCol)
queue.offer(i * col + j);
... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof RingPlot)) {
return false;
}
RingPlot that = (RingPlot) obj;
if (this.separatorsVisible != that.separatorsVisible) {
return false;
... | 8 |
@Override
public void addScript(ScriptingEngine S)
{
if(scripts==null)
scripts=new SVector<ScriptingEngine>(1);
if(S==null)
return;
if(!scripts.contains(S))
{
ScriptingEngine S2=null;
for(int s=0;s<scripts.size();s++)
{
S2=scripts.get(s);
if((S2!=null)&&(S2.getScript().equalsIgnoreCase(... | 7 |
public void repositionFlyUps() {
// removeDeadFlyUps();
int basePosition = 15 + (!permanentFlyUp.equals("") ? 0 : 15);
for(FlyUp fly:flyups) {
fly.setDistanceAboveRobot(basePosition);
basePosition += 15;
}
} | 2 |
@Test
public void testGet() {
final double height = 10;
final double width = 8;
assertEquals("Side should be LEFT", Side.get(0, 2, width, height), Side.LEFT);
assertEquals("Side should be LEFT", Side.get(0, 2.5, width, height), Side.LEFT);
assertEquals("Side should be LEFT",... | 4 |
public static void writeElementStart(
StringBuffer buf,
int depth,
boolean empty,
String line_ending,
String name,
Map attributes
) throws IllegalArgumentException {
if (isValidXMLElementName(name)) {
indent(buf, depth);
buf.append("<").append(name);
if (attributes != null) {
Iterator i... | 6 |
public boolean isFightCaveNpc(int i) {
switch (npcs[i].npcType) {
case 2627:
case 2630:
case 2631:
case 2741:
case 2743:
case 2745:
return true;
}
return false;
} | 6 |
public void disableArena() {
if (this.arenastate == ArenaState.STAT_READY
|| this.arenastate == ArenaState.STAT_STARTED)
this.endGame(EndReason.END_REASON_ARENADISABLE);
else if (this.arenastate == ArenaState.STAT_OPEN) {
for (Player p : players) {
this.removeplayer(p);
p.sendMessage(ChatColor.RED... | 4 |
public synchronized void remove(long channelId, int clientId) {
int i=0;
for(TVChannel chann:channels){
if(chann.getChannelId()==channelId && chann.getClientId()==clientId){
channels.remove(i++);
}
}
} | 3 |
public void addItemtoRedo(ArrayList<UndoableItem> udi) {
redoStack.push(udi);
} | 0 |
private void setVerLength(int verLength) {
if (verLength < 10)
throw new IllegalArgumentException("The size of the grid has to be at least 10x10!");
this.verLength = verLength;
} | 1 |
public void run()
{
DataInputStream stream1 = new DataInputStream(this.file1);
DataInputStream stream2 = new DataInputStream(this.file2);
try {
while (!suspending) {
// Deserialize if its an already existing object and resume from there or simply go with the this reference
String line1 = stream1.re... | 7 |
public Detalle(int idDetalle, Tpv tpv, Encargo encargo, Producto producto, String otro, double cantidad, double precio) {
this.idDetalle = idDetalle;
this.tpv = tpv;
this.encargo = encargo;
this.producto = producto;
this.otro = otro;
this.cantidad = cantidad;
this... | 0 |
@Override
public Server getServer() { return Plugin.getServer(); } | 0 |
private float computeFix(List<JstatItem> jstatItemList) {
List<Float> fixList = new ArrayList<Float>();
for(JstatItem item : jstatItemList) {
if(item.getOU() > fismb)
fixList.add(item.getOU() - fismb);
}
if(fixList.isEmpty())
return 0;
else {
float sum = 0;
for(Float f : fixList)
sum ... | 4 |
private void sendEvent(String eventMessage) throws MMTConnectorException, IOException {
String postMessage = EventParameterName + "=" + eventMessage;
HttpURLConnection connection = (HttpURLConnection) this.getConnectorConfig().getServerURL().openConnection();
connection.setRequestMethod("POST");... | 3 |
@RequestMapping({"/", "index"})
public String index() {
return "index";
} | 0 |
public AdjustMoneyEditor() {
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setTitle("Adjust Money Editor");
setBounds(100, 100, 343, 234);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
con... | 1 |
@SuppressWarnings({ "deprecation", "unused" })
public static boolean areItemsInDatabase(Player pl, ItemStack is, int qty) {
if (is == null)
return false;
int playerID = getPlayerId(pl.getUniqueId());
WebInventoryMeta wim = new WebInventoryMeta(is);
ResultSet rs = null;
try {
Connection conn = MineAucti... | 4 |
private boolean jj_3_43() {
if (jj_3R_62()) return true;
if (jj_3R_56()) return true;
return false;
} | 2 |
public boolean jumpMayBeChanged() {
return subBlock.jump != null || subBlock.jumpMayBeChanged();
} | 1 |
@Override
public void deserialize(Buffer buf) {
worldX = buf.readShort();
if (worldX < -255 || worldX > 255)
throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255");
worldY = buf.readShor... | 5 |
private int getNextPiece(Peer p) {
boolean[] peerBitfield = p.getBitfield();
boolean[] bitfield = tracker.getHost().getBitfield();
if(peerBitfield == null)
return -1;
for(int i = 0; i < bitfield.length; i++){
if(!bitfield[i] && peerBitfield[i]){
return i;
}
}
return -1;
} | 4 |
public void run() {
GroundItem spice = Util.getSpice();
int count = Inventory.getCount(spice.getId());
if (lootSpice()) {
int time = 0;
while (Inventory.getCount(spice.getId()) <= count && time <= 5000) {
time += 50;
Time.sleep(50);
}
}
} | 3 |
public KjStroke getReducedNoise(){
KjStroke result = new KjStroke();
if (pointList.size()<=2){
for(int i=0;i<pointList.size();i++){
result.addPoint(pointList.get(i));
}
} else {
result.addPoint(pointList.get(0));
for(int i=1;i<pointList.size()-1;i++){
ArrayList<Point> temp = new ArrayList<Poin... | 7 |
public Aresta retiraAresta(int v1, int v2) {
int index;
for (index = v1; this.prox[index] != 0; index = this.prox[index])
if (this.cab[this.prox[index]] == v2)
break;
int ind = this.prox[index];
if (this.cab[ind] == v2) {
Aresta aresta = new Aresta(v1, v2, this.peso[ind]);
this.cab[ind] = ... | 4 |
@Override
public int compareTo(Object obj) {
String objString = null;
String ourString = null;
// if obj is not effectively one of us ...
if (! this.getClass().isInstance(obj)) {
throw new ClassCastException ();
}
// get the strings
objString = ((StrungDocumentInfo)obj).getString();
ourString ... | 2 |
private boolean hiddenField(String name) {
boolean hidden = false;
for (int i = 0; i < HIDDEN.length; i++) {
if (HIDDEN[i].equals(name))
hidden = true;
}
return hidden;
} | 2 |
private CvSeq findBiggestContour(IplImage imgThreshed) {
CvSeq bigContour = null;
CvSeq contours = new CvSeq(null);
cvFindContours(imgThreshed, contourStorage, contours, Loader.sizeof(CvContour.class), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
float maxArea = SMALLEST_AREA;
CvBox2D... | 5 |
static Coordinates nextBackwardPosition(Coordinates position, Direction direction) {
if (direction == NORTH)
return new Coordinates(position.getX(), position.getY() - 1);
if (direction == SOUTH)
return new Coordinates(position.getX(), position.getY() + 1);
if (direction =... | 3 |
@Override
public void extract() throws XMLStreamException, FileNotFoundException
{
FileInfo simc = this.bfis.get(Parser.Types.SIMC.toString());
this.factory = XMLInputFactory.newInstance();
this.readerRaw = factory.createXMLStreamReader(new BufferedInputStream(new FileInputStream(... | 5 |
boolean isLeapYear(int year) {
if (year == 0) {
throw new IllegalArgumentException("Illegal year: " + year);
}
return mod(year, 4) == (year > 0 ? 0 : 3);
} | 2 |
public World(int size)
{
this.size = size;
w = new String[size+1][size+1];
for (int x = 0; x <= size; x++)
{
for (int y = 0; y <= size; y++)
{
w[x][y] = UNKNOWN;
}
}
setVisited(1, 1);
} | 2 |
@Test
public void testCheckCellStatus() throws IOException {
System.out.println("checkCellStatus");
int[] cell = new int[2];
cell[0] = 1;
cell[1] = 1;
Sense.condition cond = Sense.condFromString("FRIEND");
AntBrain ab = new AntBrain("cleverbrain1.brain");
... | 0 |
public static void pollIO() {
// Clear KeyPresses
for(int i=0; i<keyPress.length; i++) keyPress[i] = false;
// Update Keyboard Table
while(Keyboard.next()) {
if(Keyboard.getEventKeyState()) {
keyDown[Keyboard.getEventKey()] = true;
} else {
keyDown[Keyboard.getEventKey()] = false;
keyPress[... | 9 |
private void LoadContent() {
try {
URL carImgUrl = this.getClass().getResource("/raceresources/resources/images/car2.png");
carImg = ImageIO.read(carImgUrl);
carImgWidth = carImg.getWidth();
carImgHeight = carImg.getHeight();
URL carWonImgUrl = this.g... | 1 |
public static void run(TestOptions testOption){
if (testOption == TestOptions.ALL_TESTS){
for (TestOptions option : TestOptions.values()){
if (option != TestOptions.ALL_TESTS){
if (option != TestOptions.PCB442 && option != TestOptions.PR2392){
runTestingInstance(option);
}
}
}
}
else... | 5 |
public int restriccionTabu(double cambio, int indice1, int indice2)
{
String url = "jdbc:derby://localhost:1527/PDPIVP";
String selectdatos="SELECT * FROM EstructuraTabu";
double resultadotabu=0;
double resultadofinal=0;
int indice1_var=0;
int indice2_var=0;
int tabu=0;
try{
Clas... | 6 |
public static void main(String[] args) {
Estrutura ed = new Estrutura(100);
Scanner scan = new Scanner(System.in);
String cor;
double altura;
while (true) {
menuPrincipal();
String res = scan.next();
switch (res){
... | 6 |
public static void addFille(Personne pers, Fille fille) {
List enfants;
try {
if (pers instanceof Pere) {//Un pere ajoute un fils
//On recupere la liste des enfants du pere
enfants = ((Pere) pers).getEnfants();
fille.setPere((Pere) pers);
... | 7 |
@Override
public void select(int howMany, Population from, Population to) {
double fitnessSum = 0.0;
for (int i = 0; i < from.getPopulationSize(); i++) {
fitnessSum += from.get(i).getFitnessValue();
}
double[] fitnesses = new double[from.getPopulationSize()];
... | 7 |
private void handleMetaInput() {
if (this.equalsHelper.state()) {
this.tileSize += 5;
if (this.tileSize > 100) {
this.tileSize = 100;
}
} else if (this.minusHelper.state()) {
this.tileSize -= 5;
if (this.tileSize < 25) {
this.tileSize = 25;
}
}
} | 4 |
public void deleteLevel(int id)
{
try
{
PreparedStatement ps = con.prepareStatement( "DELETE FROM teacher WHERE id=?" );
ps.setInt( 1, id );
ps.executeUpdate();
ps.close();
}
catch( SQLException e )
{
e.printStackTrace();
}
} | 1 |
public void sendRobotData() {
HashMap<String, Player> players = new HashMap<String, Player>(registry.getPlayerManager().getPlayers());
try {
for (String key : players.keySet()) {
Player p = (Player) players.get(key);
if (p != null && p.getRobot().getIsActivate... | 6 |
@Override
public void pressedBuyItem(ItemType itemType) {
ItemData itemStats = Game.getItemData(itemType);
if (HeroInfo.INSTANCE.isHeroAlive()) {
if (money >= itemStats.buyCost && HeroInfo.INSTANCE.hasSpaceForItem(itemType) && GamePlayState.isHeroAliveAndCloseEnoughToMerchant()) {
HeroInfo.INSTANCE.equipIte... | 5 |
private final boolean inputNotCorrect(JFileChooser c) {
if (tf_credName.getText().equals("") || tf_credID.getText().equals("")
|| tf_credIBAN.getText().equals("")
|| tf_credBIC.getText().equals("")
|| tf_execDate.getText().equals("")) {
JOptionPane.showMessageDialog(c,
texte.getString("D_MISSING_V... | 6 |
private void add(int previous, int index, Node node) {
Node[] children = node.getChildren(); // nodes following current node
if(node.getChildren().length > 0 && node.hasSinglePath() && node.getChildren()[0].getKey() != TERMINATING_CHARACTER) { // If node has only one path, put the rest in tail array
baseBuffer.... | 5 |
private void actionShowScores(int difficulty) {
String msg = "<html>";
msg += "<font size=4>";
msg += "Best results - ";
switch (difficulty) {
case Grid.DIFFICULTY_EASY: msg += "easy"; break;
case Grid.DIFFICULTY_MEDIUM: msg += "medium"; break;
case Gr... | 5 |
public User(String n) {
name = n;
} | 0 |
public void setMACKey(EncryptedDataType value) {
this.macKey = value;
} | 0 |
public void run() {
switch(serv) {
case WORLDNAMES:
setWorldNames(services.getAllWorldNames(lang));
System.out.println("worldnames: "+worldNames.size());
break;
case MAPNAMES:
setMapNames(services.getAllMapNames(lang));
System.out.println("mapnames: "+mapNames.size());
break;
... | 5 |
public static void dehoist(Node currentNode) {
currentNode.getTree().getDocument().hoistStack.dehoist();
return;
} | 0 |
public boolean equals(Object obj) {
if (obj == this)
return true;
if (obj == null)
return false;
if (obj.getClass() != this.getClass())
return false;
Picture that = (Picture) obj;
if (this.width() != that.width())
return false;
if (this.height() != that.height())
return false;
for (int x = ... | 8 |
public static File getFile(Component parent, String title, boolean write) {
JFileChooser fc = new JFileChooser();
fc.setDialogTitle(title);
if (write) {
fc.showSaveDialog(parent);
} else {
fc.showOpenDialog(parent);
}
File f = fc.getSelectedFile();
if (f == null || (!write && !f.exists()) || (f.exis... | 9 |
public String getHostname() {
return _hostname;
} | 0 |
protected boolean isMatchingStrategyList( List<StrategyT> aStrategyList1, List<StrategyT> aStrategyList2 )
{
if ( ( aStrategyList1 != null ) && ( aStrategyList2 != null ) )
{
if ( aStrategyList1.size() == aStrategyList2.size() )
{
for ( int i=0; i < aStrategyList1.size(); i++ )
{
if ( aStrategyL... | 7 |
public ArrayList<Integer[]> selection2(ArrayList<Integer[]> population, int size) {
if (size > population.size()) {
return population;
}
ArrayList<Integer[]> parents = new ArrayList<>();
//int matchLength = grades.length / size;
while (parents.size() < size) {
... | 4 |
public boolean equals(Auction auction){
if(this.id == auction.id){
return true;
}
else{
return false;
}
} | 1 |
int truncatetable(String tableName) throws ClassNotFoundException, InstantiationException, SQLException, IllegalAccessException {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection(url, dbUser, dbPass);
Statement stm = con.createStatement();
... | 1 |
public void flush()
{
if (myBitsToGo != BITS_PER_BYTE) {
try{
write( (myBuffer << myBitsToGo) );
}
catch (java.io.IOException ioe){
throw new RuntimeException("error writing bits on flush " + ioe);
}
myBuffer = 0;
... | 3 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
int n = sc.nextInt();
if(n==0)break;
C[] c = new C[n];
for(int i=0;i<n;i++)c[i]=new C(new Point(sc.nextDouble(), sc.nextDouble()), sc.nextDouble());
int m = sc.nextInt();
while(m--!=0){
Point u = new Poi... | 9 |
private int travelTree(TreeNode node) {
if(node == null) return 0;
int left = travelTree(node.left);
if(left == -1) return -1;
int right = travelTree(node.right);
if(right == -1) return -1;
if(Math.abs(left - right) > 1) return -1;
return left > right ? left + ... | 5 |
@Override
public void handleQuitRequestWith(QuitEvent event, QuitResponse response) {
if (!UIUtilities.inModalState()) {
mAllowQuitIfNoSignificantWindowsOpen = false;
if (closeFrames(true)) {
if (closeFrames(false)) {
saveState();
response.performQuit();
return;
}
}
mAllowQuitIfNoS... | 3 |
static LinkedList<Part> sort2(LinkedList<Part> unsorted)
{
if (unsorted.size() <= 1)
return unsorted;
int mid = unsorted.size()/2;
int size = unsorted.size();
LinkedList<Part> sorted = new LinkedList<Part>();
LinkedList<Part> first = new LinkedList<Part>();
LinkedList<Part> second = new LinkedList<Part>... | 8 |
public Message toMsgAlbe(String ocsfMsg) {
Message msg = new Message();
StringTokenizer st = new StringTokenizer(ocsfMsg);
msg.setRoomNumber(Integer.parseInt(st.nextToken()));
Room r = s.getRoom(msg.getRoomNumber());
String id = st.nextToken();
msg.setWhat(Integer.parseInt((msg.getRoomNumber()==0 || msg.get... | 9 |
private void processWithClassName(ClassLoader classloader, String className, String prefix, TmpStatics tmpStatics) {
Class clazz;
String identification = null;
try {
clazz = classloader.loadClass(className);
Field id = clazz.getField("ID");
identification = (S... | 4 |
public static void init() {
codes.put("HALT", "HaltCode");
codes.put("POP", "PopCode");
codes.put("FALSEBRANCH", "FalseBranchCode");
codes.put("GOTO", "GoToCode");
codes.put("STORE", "StoreCode");
codes.put("LOAD", "LoadCode");
codes.put("LIT", "LitCode");
... | 0 |
@Override
public boolean isInternal(Position<T> p) throws InvalidPositionException {
checkPosition(p);
return (hasLeft(p) || hasRight(p));
} | 1 |
public int calcHLine2(State m) {
int line, column;
int hLine = 0;
for (line = 0; line < m.puzzle.getHeight(); line++) {
for (column = 0; column < m.puzzle.getLength(); column++) {
if ((column == (m.puzzle.getLength() - 1))
&& (line < m.puzzle.... | 7 |
private void play() {
String gameid = askForNewGame();
int attemptCount = sendAnAttempt(gameid, null);
if (attemptCount == -1) {
System.out.println("PERDU");
} else {
System.out.println("J'ai gagné en " + attemptCount + "!");
}
} | 1 |
public void reorderList(ListNode head) {
// 1. get the middle node of the list (even / odd) and tail node
// 2. divide the list into halves
// 3. reverse the second half, merge two lists
if (head == null)
return;
if (head.next == null)
return;
ListNode fast = head, slow = head;
// temp head of merge... | 9 |
public synchronized boolean hasMessage() {
while(_buffers.size() > 0) {
ByteBuffer bytes = _buffers.remove(0);
CharBuffer chars = CharBuffer.allocate(bytes.remaining());
this._decoder.decode(bytes, chars, false); // false: more bytes may follow. Any unused bytes are kept in the decoder... | 1 |
public void clearMap(GameAction gameAction) {
for (int i=0; i<keyActions.length; i++) {
if (keyActions[i] == gameAction) {
keyActions[i] = null;
}
}
for (int i=0; i<mouseActions.length; i++) {
if (mouseActions[i] == gameAction) {
... | 4 |
public void setValue(BigDecimal aValue)
{
BigDecimal tempValue = aValue;
// 12/15/2010 Scott Atwell if ( ( getMinimum() != null ) && ( tempValue.compareTo( getMinimum() ) < 0 ) )
if ( ( getMinimum() != null ) && ( tempValue != null ) && ( tempValue.compareTo( getMinimum() ) < 0 ) )
{
tempValue = getMinim... | 7 |
private int addConfigFields(JPanel p, String groupName)
{
GridBagConstraints c = new GridBagConstraints();
c.gridy = 0;
c.anchor = GridBagConstraints.WEST;
c.insets = new Insets(1, 1, 1, 1);
c.fill = GridBagConstraints.HORIZONTAL;
c.weighty = 1;
for (final Field f : CraftConfig.class.getFields())
{
... | 9 |
private double edgeY(int x, int y, double[][] smoothedGray) {
return 1*smoothedGray[x-1][y-1] - 1*smoothedGray[x+1][y-1] +
2*smoothedGray[x-1][y] - 2*smoothedGray[x+1][y] +
1*smoothedGray[x-1][y+1] - 1*smoothedGray[x+1][y+1];
} | 0 |
public void setImgPath_CommandBtn(Path img, Imagetype type) {
switch (type) {
case KEYFOCUS:
this.imgComBtn_KFoc = handleImage(img, UIResNumbers.COMBTN_KFOC.getNum());
if (this.imgComBtn_KFoc == null) {
this.imgComBtn_KFoc = UIDefaultImagePaths.COM... | 9 |
@Override
public boolean equals(Object object) {
if (!(object instanceof UserGroup)) {
return false;
}
UserGroup other = (UserGroup) object;
if ((this.groupName == null && other.groupName != null) || (this.groupName != null && !this.groupName.equals(other.groupName))) {
... | 5 |
public void parseMethod(TypeDeclaration typeDecl, MethodDeclaration methodDecl, Method method) {
Type[] types = method.getArgumentTypes();
int offset;
if (Modifier.isStatic(methodDecl.getAccess())) {
offset = 0;
} else {
// Reference to this is first argu... | 9 |
public void checkParameters(String[] args) {
if ((args.length == 1) && args[0].equalsIgnoreCase("-help")) {
System.out.println("Parameters: \r\n (1) total number of entries [optional, defaulfs to 10,000]");
}
if (args.length > 0) {
documentCount = Integer.parseInt(args[0... | 3 |
public static void main(String args[]) throws SQLException {
//Troca o LookAndFeel
try {
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogg... | 6 |
private void visitExpr(FormatDecl.BitField f, String name, int bit, int[] result) {
Expr e = f.field;
if ( matches(e, name) ) {
for ( int cntr = 0; cntr < f.getWidth(); cntr++ ) result[cntr] = cntr + bit;
} else if ( e.isBitRangeExpr() ) {
FixedRangeEx... | 9 |
public final void updatePosition(int x, int y, boolean flag) {
if (animationId != -1 && Sequence.sequenceCache[animationId].walkProperties == 1) {
animationId = -1;
}
if (!flag) {
int destX = x - walkQueueX[0];
int destY = y - walkQueueY[0];
if (destX >= -8 && destX <= 8 && destY >= -8 && destY <= 8) ... | 9 |
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.