text stringlengths 14 410k | label int32 0 9 |
|---|---|
public ConstOperator deobfuscateString(ConstOperator op) {
ClassAnalyzer clazz = methodAnalyzer.getClassAnalyzer();
MethodAnalyzer ma = clazz.getMethod(methodName, methodType);
if (ma == null)
return null;
Environment env = new Environment("L"
+ methodAnalyzer.getClazz().getName().replace('.', '/') + ";"... | 5 |
int clear(){
vb.clear();
vd.clear();
os.clear();
if(vi!=null && links!=0){
for(int i=0;i<links;i++){
vi[i].clear();
vc[i].clear();
}
vi=null;
vc=null;
}
if(dataoffsets!=null)dataoffsets=null;
if(pcmlengths!=null)pcmlengths=null;
if(serialnos!=null)serialnos... | 7 |
public boolean put(int key,int value){
LinkedNode root = this;
if(root == null){
return false;
}
while(root.getNext()!=null){
if(root.getKey() == key)
return false;
root = root.getNext();
}
if(root.getKey() == key)
... | 4 |
@Override
public Move makeMove()
{
String input = null;
Boolean inputError = false;
do
{
try
{
if (inputError)
{
_writer.write("Invalid input. Try again.");
_writer.newLine();
}
input = _reader.readLine();
if (input != null && input.charAt(0) == 'q')
retur... | 8 |
private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
if (estaModoEdicao() && exclusaoConfirmada()) {
try {
excluir();
} catch (ValidacaoException ex) {
_unitOfWork.rollback();
... | 3 |
public char getItemType(Position position) {
if (!isOccupied(position)) {
return ' ';
}
return field.get(position).getType();
} | 1 |
private String pickItem() {
Random rand = new Random();
int num = rand.nextInt(config.getPoorChance() + config.getAverageChance() + config.getGoodChance() + config.getTopChance()) + 1;
if (num <= config.getPoorChance()) {
itemQuality = quality.poor;
return config.getPoorI... | 4 |
public void paint(Graphics g) {
Clan clan = clan();
if(clan==null){return;}
super.paint(g);
int r = 0;
String S;
for(Quest q : clan.MB.QuestStack) { //reverse order?
g.drawString(S = q.description(), 2, BHGT+BHGT*r++);
refreshWid(g, S);
}
r = REPORTSTART;
g.drawString("GobLog:", 2, BHGT+BHGT*r++... | 5 |
public String getOutput(State state)
{
if(myMap.get(state) == null)
return "";
else
return (String) myMap.get(state);
} | 1 |
public void update()
{
if ( oldPos != null )
{
oldPos.set( pos );
oldRot.set( rot );
oldScale.set( scale );
}
else
{
oldPos = new Vector3f( 0, 0, 0 ).set( pos ).add( 1.0f );
oldRot = new Quaternion( 0, 0, 0, 0 ).set( rot ).mul( 0.5f );
oldScale = new Vector3f( 0, 0, 0 ).set( scale ).add( 1.... | 1 |
public Component getTableCellRendererComponent
(JTable table, Object value, boolean selected, boolean focused, int row, int column)
{
setEnabled(table == null || table.isEnabled());
setBackground(null);
setForeground(null);
if(column==0) {
... | 6 |
public void calculate(float num)
{
switch(oper)
{
case "+":
total += num;
break;
case "-":
total -= num;
break;
case "*":
total *= num;
break;
case "/":
total /= num;
break;
case " ":
total = num;
case "=":
default:
}
} | 6 |
protected void readAndSaveFile(MultipartStreamHandler aStream, String aBoundary, String aFilename) throws IOException
{
File f = new File(fSaveDir + File.separator + aFilename);
FileOutputStream fout = new FileOutputStream(f);
BufferedOutputStream bout = new BufferedOutputStream(fout, 8196);
... | 9 |
public int size() {
return queue.size();
} | 0 |
public static void deleteDirectory(File file) {
if (file.exists()) {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File f : files) {
if (f.isDirectory()) {
deleteDirectory(f);
} else {
f.delete();
}
}
}
file.delete();
}
} | 4 |
@Override
public Value evaluate(Value... arguments) throws Exception {
// Check the number of argument
if (arguments.length == 1) {
// get Value
Value value = arguments[0];
// If numerical
if (value.getType().isNumeric()) {
return new Value(new Double(Math.acos(value.getDouble())));
}
if (v... | 4 |
@Override
public double evaluate(int[][] board) {
int max = 0, secondMax = 0;
int maxX = -1, maxY = -1, sMaxX = -1, sMaxY = -1;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if(board[i][j] > max) {
secondM... | 4 |
public static String trimAllWhitespace(String str) {
if (!hasLength(str)) {
return str;
}
StringBuilder sb = new StringBuilder(str);
int index = 0;
while (sb.length() > index) {
if (Character.isWhitespace(sb.charAt(index))) {
sb.deleteCharAt(index);
}
else {
index++;
}
}
return sb.t... | 3 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Option)) {
return false;
}
Option other = (Option) object;
if ((this.idOption == null && other.idOption != null... | 5 |
private void parse(String json) throws JsonException {
final String res = json.trim();
// Try trivial variants
if ("{}".equals(res) || "{ }".equals(res)) { // Empty Object
this.type = JsonType.OBJECT;
objectData = new HashMap<>();
return;
}
if... | 9 |
public void doRunKeys(int run) throws Exception {
if (m_ResultProducer == null) {
throw new Exception("No ResultProducer set");
}
if (m_ResultListener == null) {
throw new Exception("No ResultListener set");
}
if (m_Instances == null) {
throw new Exception("No Instances set");
... | 7 |
@WebMethod(operationName = "ReadStock")
public ArrayList<Stock> ReadStock(@WebParam(name = "stock_id") String stock_id) {
Stock stock = new Stock();
ArrayList<Stock> stocks = new ArrayList<Stock>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
if(!st... | 3 |
public static String readPropeties() {
System.out.println("Entering readProperties() in "+DATE_FORMAT.format(new Date()));
Thread.currentThread().setName("ReadProperties-"+COUNT++);
Properties protoProp = new Properties();
String propLoc = "message.properties";
String root = "C:\... | 4 |
public void load()
{
ready=false;
BufferedImage temp = getImage( FileName );
if( temp!=null )
{
int xFrame = temp.getWidth(null);
int yFrame = temp.getHeight(null);
int counter_x, counter_y ;
boolean set=false;
if( scale )
{
xSize=(short)xFrame; ySize=(short)yFrame;
xHalf=(short)(x... | 7 |
private int readLength() throws StreamCorruptedException {
StringBuffer lenStr = new StringBuffer();
while (input.remaining() > 0) {
char ch = input.get();
if (ch == ':') {
//indexPlus(1);
break;
} else {
lenStr.append(ch);
}
}
int arrayLen = 0;
try {
arrayLen = Integer.valueOf(lenS... | 3 |
public void addAccount(BankAccount account) throws IllegalArgumentException {
if (! canHaveAsAccount(account))
throw new IllegalArgumentException();
accounts.add(account);
} | 1 |
private boolean processCommand(Command command)
{
boolean wantToQuit = false;
CommandWord commandWord = command.getCommandWord();
switch (commandWord) {
case UNKNOWN:
System.out.println("I don't know what you mean...");
tryMoveCharacters();
... | 7 |
@Override
public boolean startVideoProcessing(File videoFile) {
if (this.window == null || this.adFinder == null)
return false;
return this.adFinder.startVideoProcessing(videoFile);
} | 2 |
public void addBestModel(List<CartsModel> toadd) {
for (CartsModel cm : toadd) {
if (locm.isEmpty()
|| locm.get(0).getModel_bandwith() > cm.getModel_bandwith()) {
locm.clear();
locm.add(cm);
}
}
} | 3 |
public boolean search(String word) {
Queue<TrieNode> queue = new LinkedList<TrieNode>();
TrieNode node = root;
queue.add(node);
int index = 0;
while (!queue.isEmpty()) {
if (index == word.length())
return true;
TrieNode curr = queue.poll();
if (index == word.length() - 1)
return curr.flag;
... | 8 |
protected Component getView() {
return view;
} | 0 |
public ListNode detectCycle(ListNode head) {
ListNode fast = head;
ListNode slow = head;
if(head == null) {
return null;
}
if(head.next == null) {
return null;
}
if(head.next.equals(head)) {
return head;
}
int fastSpeed = 2;
boolean firstMeet = true;
while(fast.next != null) {
for(int ... | 8 |
@Override
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
DatabaseManager manager=DatabaseManager.getManager();
String begin=request.getParameter(Booking.BEGIN);
String end=request.getParameter(Booking.END);
try {
if(!MyServlet.isEmpty(begin... | 4 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public void menuUpdate(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
if(playTheme ==true){
theme.playAsSoundEffect(1.0f, 1.0f, false);
playTheme=false;
Mouse.setGrabbed(false);
}
else{}
if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)){
Screen=0;
}
} | 2 |
public JComponent createAbsolute_Position()
{
JTabbedPane tabbedPane = new JTabbedPane();
// Pos tab
final JPanel posPanel = createTabPanel(new MigLayout());
posPanel.add(createButton(), "pos 0.5al 0al");
posPanel.add(createButton(), "pos 1al 0al");
posPanel.add(createButton(), "pos 0.5al 0.5al");
posP... | 7 |
public String getName() {
return name;
} | 0 |
public static ArrayList<ArrayList<Integer>> zigzagLevelOrder2(TreeNode root) {
ArrayList<ArrayList<Integer>> resultLists = new ArrayList<ArrayList<Integer>>();
if (root == null) {
return resultLists;
}
Stack<TreeNode> currentLevel = new Stack<TreeNode>();
currentLevel.push(root);
Boolean leftToRight = fa... | 8 |
public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
if (bodyBlock == oldBlock)
bodyBlock = newBlock;
else
return false;
return true;
} | 1 |
public Object GetConfig(String section, String option)
{
//get hashtable for the section
Hashtable tmp = (Hashtable)configSections.get(section.toUpperCase());
//get the value of the option
return tmp.get(option.toUpperCase());
} | 0 |
public int nextSetBit(int fromIndex)
{
if (fromIndex < 0)
throw new IndexOutOfBoundsException("fromIndex < 0: " + fromIndex);
checkInvariants();
int u = wordIndex(fromIndex);
if (u >= wordsInUse)
return -1;
long word = words[... | 5 |
private boolean checaTipoDaVariavelEmRegistro(String nomeVariavel, String tipoDoRetorno) {
if(!listaVariveisRegistro.isEmpty()){
if(!listaDeBlocos.isEmpty()){
for(int j=0;j< listaDeBlocos.size();j++){
String [] tabela1 = listaDeBlocos.get(j).split("~");
... | 8 |
private Integer[][] goDijkstra(int x, int y) {
int profondeur = 0;
Integer dijkstra[][] = new Integer[taille_envi][taille_envi];
Stack<Point> toDo = new Stack<Point>();
toDo.add(new Point(x, y));
for (int j = 0; j < taille_envi; j++) {
for (int i = 0; i < taille_envi; i++) {
dijkstra[i][j] = -1;
}
... | 3 |
private boolean isConstant(String token) throws Exception {
//check if character constant
if ( token.startsWith("'") ) {
if (token.endsWith("'") && token.length()<=3) {
return true;
} else {
throw new Exception("Wrong chacter constant!");
... | 7 |
private String principalComponentsSummary() {
StringBuffer result = new StringBuffer();
double cumulative = 0.0;
Instances output = null;
int numVectors=0;
try {
output = setOutputFormat();
numVectors = (output.classIndex() < 0)
? output.numAttributes()
: output.numAttr... | 7 |
@Test
public void testThrowsOnIncorrectSignatur() {
try {
assertNotNull(Sx.mk(new SxController() {
@Selector("s")
void f1() {
}
}));
fail("Should throw");
} catch (RuntimeException ex) {
}
try {
assertNotNull(Sx.mk(new SxController() {
@Selector("s")
void f2(String a1, HashMap<?... | 4 |
@Override
public void run(ListIterator<Instruction> iter)
throws Exception {
Instruction i = iter.next();
if(i instanceof ArrayIndex) {
iter.remove(); // remove instruction i
ArrayList<Instruction> code = ((ArrayIndex)i).getIndexingCalculation();
BasicBlo... | 2 |
private void downloadSong(final SongConfig song, final FolderConfig folderConfig) {
String trackString = null;
try {
final HttpResponse trackResponse = getApi().get(new Request(String.format(Constants.TRACK_URL, song.getTrackId(), Constants.CLIENT_ID)));
trackString = EntityUtils.toString(trackResponse.getEnt... | 3 |
static void decompress(BitInputStream in, OutputStream out) throws IOException {
FrequencyTable freq = new SimpleFrequencyTable(new FlatFrequencyTable(257)); // Initialize with all symbol frequencies at 1
ArithmeticDecoder dec = new ArithmeticDecoder(in);
while (true) {
int symbol = dec.read(freq);
if (sym... | 2 |
private boolean readTape(InputStream stream) {
byte[] start = new byte[32];
dirNames.clear();
dirEntries.clear();
type = TAPE;
try {
DataInputStream reader = new DataInputStream(stream);
reader.readFully(start);
String st = new String(start);
if (st.startsWith("C64")) {
... | 8 |
public void addWay(int pos, long wayId){
if (!ways.contains(wayId))
ways.add(wayId);
} | 1 |
public static void main(String[] args) throws Exception
{
int p[] = { 30, 35, 15, 5, 10, 20, 25 };
TDMatrixChainMultiplication td = new TDMatrixChainMultiplication(p);
System.out.println("Number of scalar multiplications");
for (int i = 1; i < p.length; i++)
{
for (int j = i; j < p.length; j++)
Syste... | 4 |
@Override
public void draw(SpriteBatch batch, float parentAlpha) {
if (MyStage.isCameraView(stage, x, y)) {
update(Gdx.graphics.getDeltaTime());
if (isDead) {
batch.draw(deadTexture, x - 32, y - 32, originX, originY, width, height, 1, 1, rotation);
} else ... | 4 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((msg.source().location()!=null)
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&((msg.value())>0)
&&(msg.tool()==this)
&&(msg.target() instanceof MOB)
&&(!((MOB)msg.target()).amDead())
&&(CMLib.f... | 9 |
public static JSONObject showNotFound() {
JSONObject jo = new JSONObject();
try
{
jo.put("rtnCode", "404 not found");
} catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return jo;
} | 1 |
public String toString()
{
StringBuilder s = new StringBuilder("[");
for(T x : this)
s.append(Objects.toString(x) + ", ");
if(size > 0)
s.setLength(s.length() - 2);
s.append("]");
return new String(s);
} | 2 |
public void buscarNome(String nome){
ResultSet rs;
String sql = "SELECT * FROM alunos";
String nomes="Matric | Nome | Endereco\n\n";
try{
rs = meuState.executeQuery(sql);
while(rs.next()){
if(rs.getString("nome").toUpperCase().... | 4 |
public void func_50020_b(int par1)
{
if (this.text.length() != 0)
{
if (this.field_50048_p != this.field_50042_o)
{
this.func_50031_b("");
}
else
{
boolean var2 = par1 < 0;
int var3 = var2 ? t... | 7 |
public static Object getValue(Object object, String fieldName) throws JStrykerException, IllegalArgumentException {
if (object == null) {
throw new IllegalArgumentException("Object cannot be null.");
}
if (fieldName == null) {
throw new IllegalArgumentException("Field name cannot be null.");
}
try {
... | 4 |
private void DownloadFormButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DownloadFormButtonActionPerformed
//Get selected value and split it to get the first integer
// which is the ID of the form
String ID = (String) FormsList.getSelectedValue();
String[] test = ID.split(" ");
... | 6 |
public String toString() {
StringBuilder s = new StringBuilder();
String NEWLINE = System.getProperty("line.separator");
s.append(V + " vertices, " + E + " edges " + NEWLINE);
for (int v = 0; v < V; v++) {
s.append(String.format("%d: ", v));
for (int w : adj[v]) {... | 2 |
@Override
public IEmailKontakt create() {
EmailKontakt ek = new EmailKontakt();
return ek;
} | 0 |
private void createChromaticityCombo(PrintRequestAttributeSet set) {
Chromaticity[] chromacities = (Chromaticity[]) mService.getSupportedAttributeValues(Chromaticity.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
if (chromacities != null && chromacities.length > 0) {
HashSet<Chromaticity> possible = new Ha... | 5 |
@Override
public boolean equals(Object obj) {
ItemSet itemSet = (ItemSet) obj;// necessary casting
if (this.itemSet.size() == itemSet.getItemSet().size()) {
for (int i = 0; i < this.itemSet.size(); i++) {
if (!this.itemSet.get(i).getItem()
.equals(itemSet.getItemSet().get(i).getItem())) {
return ... | 3 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response) {
ArrayList<Producto> lista = null;
String strChkCategoria = request.getParameter("chkCategoria");
String strChkMarca = request.getParameter("chkMarca");
boolean filtrarCategoria = false;
bool... | 9 |
public static MethodSlot createEvaluatorWrapperUnit(MethodSlot method) {
{ boolean variableargumentsP = ((BooleanWrapper)(KeyValueList.dynamicSlotValue(method.dynamicSlots, Stella.SYM_STELLA_METHOD_VARIABLE_ARGUMENTSp, Stella.FALSE_WRAPPER))).wrapperValue;
boolean evaluateargumentsP = method.methodEvaluateArg... | 6 |
public boolean matchesNumber(String text) {
int numberCount = this.numberList.size();
for(int i = 0;i<numberCount;i++) {
String currentNumber = this.numberList.get(i).getLiteral();
boolean isMatchingExpression = text.equals(currentNumber);
if (isMatchingExpression) {
return true;
}
}
return f... | 2 |
private void paintGrille(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
// Paint le grillage selon la dimension
g2d.setColor(Color.black);
int separattion;
// Lignes Horizontale
for(separattion=0 ; coordonneJeu.getNombreColonne()> separattion; separattion++)
... | 2 |
protected static String convertColorToWebColorValue(Color c) {
String red = Integer.toHexString(c.getRed());
if (red.length() == 1) {
red = "0" + red;
}
String green = Integer.toHexString(c.getGreen());
if (green.length() == 1) {
green = "0" + green;
}
String blue = Integer.toHexString(c.getBlue());... | 3 |
public static void copyDirectory(File sourceLocation , File targetLocation) throws IOException {
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists())
targetLocation.mkdir();
String[] children = sourceLocation.list();
for (int i=0; i<children.length; i++)
copyDirectory(new... | 4 |
public void insert(String name) {
Occurrence newOcc = new Occurrence(name);
newOcc.next = head;
head = newOcc;
} | 0 |
public float advanceUpgrade(float progress) {
if (upgradeIndex == -1) upgradeIndex = nextUpgradeIndex() ;
if (upgradeIndex == -1) return 0 ;
//
// Update progress, and store the change for return later-
final int US = upgradeStates[upgradeIndex] ;
final float oldP = upgradeProgress ;
upgrad... | 5 |
@Test public void checkImageGeneration() {
try {
reduct.setSourceImage(ImageIO.read(new File("src/test/resources/Mario.png")));
reduct.setDestBitDepth(3);
reduct.generateImage();
assertTrue(reduct.getReducedImage() != null);
} catch (IOException e) {
... | 1 |
public double getMinValue() {
if(times.length == 0) {
return -1;
}
double minval = times[0];
for(int i = 1; i < times.length; i++) {
if(times[i] < minval) {
minval = times[i];
}
}
return minval;
//returns minimum value of times-array
} | 3 |
public static boolean isCubeInFrustum(float x, float z, float y, float size) {
for(int p=0;p<6;p++) {
if(frustum[p][0]*(x-size) + frustum[p][1]*(y-size) + frustum[p][2]*(z-size) + frustum[p][3]>0)
continue;
if(frustum[p][0]*(x+size) + frustum[p][1]*(y-size) + frustum[p][2]*(z... | 9 |
public static void main(String[] args) {
try {
Console console = System.console();
if (console == null) {
System.err.println("Error : No console ! Please run it with command line :).");
System.exit(1);
}
// System.setSecurityManager(new java.rmi.RMISecurityManager());
ILoginModule lm = (ILogi... | 8 |
@Override
protected boolean validateNode(Node<T> node) {
boolean bst = super.validateNode(node);
if (!bst)
return false;
AVLNode<T> avlNode = (AVLNode<T>) node;
int balanceFactor = avlNode.getBalanceFactor();
if (balanceFactor > 1 || balanceFactor < -1) {
return false;
}
if (avlNode.isLeaf()) {
... | 9 |
public static void drawWave (Graphics g, Wave wave,
int x, int y, int width, int height,
int viewStart, int viewEnd,
boolean selected,
int selectStart, int selectEnd)
{
double[] w;
if (wave != null && (w = wave.getWave()) != null) {
double samplePos... | 7 |
void init(Molecule molec, EnergyFunction ef, double cutoff, DoubleMatrix1D dv,
ContSCObjFunction of, DoubleMatrix1D[] samples){
//Take the VDW interactions with distances below distCutoff
//if of and samples aren't null then count distances below distCutoff in any of the samples
//(f... | 7 |
@Override
public HashSet<Square> calcMoves(ChessBoard board) {
moves = new HashSet<Square>();
for(int i = 1; checkMove(board.getSquare(x+i, y)); i++) {}
for(int i = 1; checkMove(board.getSquare(x-i, y)); i++) {}
for(int i = 1; checkMove(board.getSquare(x, y+i)); i++) {}
for(int i = 1; checkMove(board.getSqua... | 8 |
public void addCustomer(Customer cust) {
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... | 4 |
@Override
public void keyTyped(KeyEvent e) {
} | 0 |
private static void quickSort(char[] arr, int low, int high) {
int i = low, j = high;
int pivot = arr[low + (high - low)/2];
while(i <= j) {
while(arr[i] < pivot)
i++;
while(arr[j] > pivot)
j--;
if(i <= j) {
exchange(arr, i, j);
i++;
j--;
}
}
if(low < j)
quickSort(arr, low, ... | 6 |
public double[] estimateGlobalLM(){
double[] lm = new double[getLMFeatureSize()];
double sum = 0;
for(_User u: m_users){
for(_Review r: u.getReviews()){
for(_SparseFeature fv: r.getLMSparse()){
lm[fv.getIndex()] += fv.getValue();
sum += fv.getValue();
}
}
}
for(int i=0; i<lm.length; i+... | 5 |
protected static Ptg calcDCountA( Ptg[] operands )
{
if( operands.length != 3 )
{
return new PtgErr( PtgErr.ERROR_NA );
}
DB db = getDb( operands[0] );
Criteria crit = getCriteria( operands[2] );
if( (db == null) || (crit == null) )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
int fNum = db.find... | 8 |
public int dropHeight(Piece piece, int x) {
int[] skirt = piece.getSkirt();
int minDistIndex = 0;
int dist = height + 10;
for (int row = 0; row < skirt.length; row++) {
int checkDist = height - getColumnHeight(x + row) + skirt[row];
if (checkDist < dist) {
dist = checkDist;
minDistIndex = row;
... | 2 |
public static void main(String[] args) {
AuctionSystemServer server = new AuctionSystemServer();
AuctionConsole console = new AuctionConsole();
Alerter.setHandler(console);
server.init();
String input;
// Read input and repeat until "stop" is entered.
do {
input = console.readLine();
} while (input ... | 2 |
public ArrayList<Position> inNeighboring(char[][] board, Position p, char x, int xSize, int ySize) {
ArrayList<Position> neighbor = new ArrayList<Position>();
if (p.x + 1 < xSize && board[p.x + 1][p.y] == x) {
neighbor.add(new Position(p.x + 1, p.y));
}
if (p.x - 1 >= 0 && bo... | 8 |
public AttemptClientConnectEvent(Object source, ISocketServerConnection socketServerConnection) {
super(source);
this.setSocketServerConnection(socketServerConnection);
} | 0 |
private Box getDominantBox()
{
Box best = null;
int bestDim = 0;
for (Box b : boxes)
{
int dim = b.dominantDimension();
if ((dim > bestDim || best == null) && b.canSplit())
{
bestDim = dim;
best = b;
}
... | 4 |
private boolean find(int n, int k) {
boolean result = false;
while (n > 0) {
if (n % 10 == k) {
result = true;
break;
} else
n = n / 10;
}
return result;
} | 2 |
public void simulateRound() {
List<MovableObject> movableSnapshot = new ArrayList<>(mMovableObjects);
//iterate over snapshot since some interactions can modify movable list
for (MovableObject movable : movableSnapshot) {
Point2D nextPosition = movable.move();
if (!isInsi... | 4 |
public double getSimilarity()
{
return _similarity;
} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
WeaponPerKiller other = (WeaponPerKiller) obj;
if (killer == null) {
if (other.killer != null) {
return false;
}
} ... | 9 |
@Override
public void mouseWheelMoved(MouseWheelEvent arg0)
{
//how much does the wheel turned?
int howMuch = arg0.getWheelRotation();
//how loud is the sound at the moment?
int percentage = audioSlider.getValue();
//no decision about how much the wheels turns
//use for every event just one st... | 4 |
public Transition[] getTransitions() {
return transitions;
} | 0 |
public void setDAO(String daoLine) {
if (daoLine.equals("Mock")) {
dao = new MockDAO();
}
else if (daoLine.equals("MySQL")) {
dao = new MySQLDAO();
}
} | 2 |
@Override
public void crash(final HTML container, final CSSClass cssClass) {
if ( Constants.fdebug )
Constants.logger.info("Logging " + this.getName( ));
final HTML h4 = HTML.create("h4", container);
h4.setValue("Dump of Registry");
final HTML table = HTML.create("table", container);
HTML tr = null;
... | 6 |
@Override
public String getString()
{
try
{
try
{
// Object o= ((Formula) this.getParentRec()).getInternalRecords().get(0); PARENT REC of ARRAY or SHRFMLA is determined by referent (record) NOT necessarily same as actual Parent Rec
Boundsheet sht = getParentRec().getSheet();
// Formula pr= (Fo... | 8 |
public void run()
{
synchronized(taskList)
{
while( true )
{
long time = System.currentTimeMillis();
if( nextTime <= time )
{
nextTask.getTask().runWatchdogTask(time);
nextTask.setLastExecMillis(time);
updateNextTask();
}
if( nextTask != null && taskList.size() > 0 )
... | 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.