text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void handle(HttpRequest request, HttpResponse response,
HttpContext context) throws HttpException, IOException {
String method = request.getRequestLine().getMethod()
.toUpperCase(Locale.ENGLISH);
if (!method.equals("GET") && !method.equals("HEAD")
&& !method.equals("POST")) {
throw n... | 7 |
public String displayGW_ShipMMSI (List<Integer> mm,int totalDigits) {
StringBuilder sb=new StringBuilder();
int a,digitCounter=0;
for (a=0;a<6;a++) {
// High nibble
int hn=(mm.get(a)&240)>>4;
// Low nibble
int ln=mm.get(a)&15;
// The following nibble
int followingNibble;
// Look at the next b... | 6 |
@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 Paciente)) {
return false;
}
Paciente other = (Paciente) object;
if ((this.idPaciente == null && other.idPacien... | 5 |
@Override
public void run() {
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
lastSample = System.nanoTime();
lastCPUSample = threadMXBean.getThreadCpuTime(monitoredThread.getId());
while (true) {
try {
Thread.sleep(interval);
} catch (InterruptedException e) {
Thread.cu... | 2 |
public static TruthValue strengthenTruthValue(TruthValue tv1, TruthValue tv2) {
if (((tv2 == Logic.TRUE_TRUTH_VALUE) ||
(tv2 == Logic.FALSE_TRUTH_VALUE)) &&
((tv1 == Logic.DEFAULT_TRUE_TRUTH_VALUE) ||
(tv1 == Logic.DEFAULT_FALSE_TRUTH_VALUE))) {
if ((tv1 == Logic.TRUE_TRUTH_VALUE) ||
... | 8 |
private final AStarNode obtainOpenWithLowestCost() {
Iterator<Entry<Float, Vector<AStarNode>>> entries = open.entrySet().iterator();
if (!entries.hasNext())
return null;
Vector<AStarNode> costEntry = entries.next().getValue();
int lastCostEntry = costEntry.size() - 1;
AStarNode lowestCostNode = costEntry.g... | 2 |
public void commit() {
Connection conn = getConnection();
try{
conn.setAutoCommit(false);
for(EntityBase ent : added.keySet() )
{
switch(ent.getOperation())
{
case insert:
{
added.get(ent).persistAdd(ent);
}
case delete:
{
added.get(ent).persistDelete(ent)... | 5 |
private void detectAnnotation(Method method, int index, Annotation annotation, Map<String, Integer> paramIndexes,
Map<String, Integer> batchParamIndexMap, Class<?>[] paramTypes) throws DaoGenerateException {
Class<? extends Annotation> annotationType = annotation.annotationType();
if (Param.class.equals(annotati... | 9 |
public static ClauseSet get(File file) {
ClauseSet clauseSet = new ClauseSet();
Scanner scan = null;
try {
scan = new Scanner(file);
while (scan.nextLine().startsWith("c")) {/* skip commments */
}
Clause clause = new Clause();
while (scan.hasNextInt()) {
int var = scan.nextInt();
if (var ==... | 5 |
public void loadProperties(String fileName) throws FileNotFoundException {
InputStream in = null;
try {
in = PropertiesReader.class.getClassLoader().getResourceAsStream(fileName);
if(in == null ){
in = new FileInputStream(System.getProperty("user.dir")+ File.separ... | 7 |
public CommandWarn(CreeperWarningMain plugin) {
this.plugin = plugin;
this.pds = new playerDataSave(plugin);
} | 0 |
protected boolean collidingWithGround() {
if(!collidable)
return false;
if(!crouch || !crouchable){
if(game.getCurrentLevel().isBlockAtPixelCollidable(x,y-(height/4)) ){
return true;
}
} else if(crouchable){
if(game.getCurrentLevel().isBlockAtPixelCollidable(x,y-(height/4)+(int)((tempHeight/crouch... | 6 |
public String toString() {
if (kind.equals(Kind.ERROR)) {
return String.format(error, kind, lexeme, lineNumber, charPosition);
}
if (kind.equals(Kind.INTEGER) || kind.equals(Kind.FLOAT)
|| kind.equals(Kind.IDENTIFIER)) {
return String.format(responseValue, kind, lexeme, lineNumber,
charPosition);
... | 4 |
public AStarNode obtainOpenNodeWithLowestCost() {
Iterator<Entry<Float, Vector<AStarNodeVector3D>>> entries = open.entrySet().iterator();
if (!entries.hasNext())
return null;
Vector<AStarNodeVector3D> costEntry = entries.next().getValue();
int lastCostEntry = costEntry.size() - 1;
AStarNode lowestCostNode ... | 2 |
public void setComando(List<?> list)
{
for(PComando e : this._comando_)
{
e.parent(null);
}
this._comando_.clear();
for(Object obj_e : list)
{
PComando e = (PComando) obj_e;
if(e.parent() != null)
{
e.pa... | 4 |
@Test
public void testRecursion() {
Recursion recursion = new Recursion();
assertTrue(recursion.nthFibonacci(0) == 0);
assertTrue(recursion.nthFibonacci(1)==1);
assertTrue(recursion.nthFibonacci(2)==1);
assertTrue(recursion.nthFibonacci(3)==2);
assertTrue(recursion.nthFibonacci(10)==55);
Set<String> s... | 5 |
public void mouseDoubleClicked(Point p){
//update current index
curr=mygraph.findIndex(p);
//pop up the curr location's property
if(curr!=-1){
JOptionPane mypane=new JOptionPane();
String display="Name:"+getCurrName()+"\n(x,y)=("
+getCurrPoint().getX()+","+getCurrPoint().getY()+")\... | 4 |
protected void doAction(int type, int bonus) {
if (!mapGenerate)
if (type == 1) {
isAttack = true;
attackDamage = getAttack(bonus);
if (Parameters.getInstance().isDebug())
logger.info("Attack damage = " + attackDamage);
... | 6 |
public void push(ArrayList<Card> list, int card) {
try {
list.add(this.card[card]);
} catch (Exception ex) {
// if arrayList becomes empty handle exception here...
}
} | 1 |
public boolean addFFmpegArgument(FFmpegArguments arguments)
{
boolean ret = false;
if (connection == null
|| arguments == null || arguments.getName() == null || arguments.getArguments() == null || arguments.getFileExtension() == null
|| hasFFmpegArgumentsName(arguments.getName()))
return ret;
try {
... | 8 |
@Override
public double[] get2DData(int px, int pz, int sx, int sz)
{
double[] da = a.get2DData(px, pz, sx, sz);
double[] db;
if(a == b)
db = da;
else
db = b.get2DData(px, pz, sx, sz);
int s = sx*sz;
for(int i = 0; i < s; i++)
da[i] = da[i] < db[i] ? da[i] : db[i];
... | 3 |
private Run prepInsertionRun(int x, int y) {
Run currentRun = getFirst();
int insertionPoint = wrap(x, y);
int position = 0;
int totalLength = width * height;
while(position < totalLength) {
if(insertionPoint > currentRun.getRunLength() + position - 1) {
position += currentRun.getRunLength()... | 4 |
List<CourseListing> getByType(String selectedType) {
List<CourseListing> courseListing = new ArrayList<CourseListing>();
try {
//Connect to database
conn = DriverManager.getConnection(url, userName, password);
stmt = conn.createStatement();
ResultSet r... | 8 |
final public void setFooter(String firstLine, String... additionalLines) {
footer.clear();
footer.add(firstLine);
if (additionalLines != null) {
for (String line : additionalLines) {
footer.add(line);
}
}
onChange();
} | 2 |
public ArrayList<Gridspot> findVertices(Gridspot take, Gridspot goal)
{
ArrayList<Gridspot> retur = new ArrayList<Gridspot>();
int x = take.getXIndex(); int y = take.getYIndex();
if (!getG(x+1,y).occupied || getG(x+1,y) == goal )
{
retur.add(getG(x+1,y));
}
if (!getG(x-1,y).occupied || getG(x-1,y) ==... | 8 |
public boolean irrigated(int r, int c)
{
boolean temp = false;
if (c > 0)
{
temp = temp || verticalRivers[r][c-1];
}
if (c < cols - 1)
{
temp = temp || verticalRivers[r][c];
}
if (r > 0)
{
temp = temp || horizontalRivers[r-1][c];
}
if (r < rows - 1)
{
temp = temp || horizontalRivers... | 8 |
public static int[] generate(int n) {
Random random = new Random();
int[] list = new int[n];
for (int i = 0; i < n; ++i) {
list[i] = random.nextInt() % n;
}
return list;
} | 1 |
protected int getCorrectDirToOriginRoom(Room R, int v)
{
if(v<0)
return -1;
int dir=-1;
Room R2=null;
Exit E2=null;
int lowest=v;
for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
{
R2=R.getRoomInDir(d);
E2=R.getExitInDir(d);
if((R2!=null)&&(E2!=null)&&(E2.isOpen()))
{
final int dx=com... | 7 |
public String getAnswer() throws Exception {
Map<Integer,Integer> cache = new HashMap<Integer, Integer>();
Stack<Integer> currChain = new Stack<Integer>();
int[] digitFactorials = getDigitFactorials();
int retVal = 0;
for (int i = 1;i<1000000;i++) {
if (cache.contain... | 9 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
throw new RuntimeException();
} | 0 |
@Test
@TestLink(externalId = "T2")
public void testFailed() {
assertTrue("Failed", false);
} | 0 |
public String encrypt(String word){
if(word == null||word.length()==0) throw new IllegalArgumentException();
String result = "";
String wordLower = word.toLowerCase();
for(int i=0; i<wordLower.length(); i++){
if(wordLower.charAt(i)<97 || wordLower.charAt(i)>122)
throw new IllegalArgumentException();
i... | 5 |
public void fillDeck()
{
int z = 0;
for(int i = 0; i < 20; i++)
{
switch (z)
{
case 0: addCard(new pieThrow()); z++; break;
case 1: addCard(new attack()); z++; break;
case 2: addCard(new fireEverythin... | 8 |
public void makePayment(int amount) {
this.balance = this.balance - amount;
} | 0 |
protected Transition createTransition(State from, State to, Node node,
Map e2t, boolean bool) {
String read = (String) e2t.get(TRANSITION_READ_NAME);
String pop = (String) e2t.get(TRANSITION_POP_NAME);
String push = (String) e2t.get(TRANSITION_PUSH_NAME);
if (read == null)
read = ""; // Allow lambda trans... | 4 |
public void setDesc(String value) {
this.desc = value;
} | 0 |
public boolean isSheetExist(String sheetName){
int index = workbook.getSheetIndex(sheetName);
if(index==-1){
index=workbook.getSheetIndex(sheetName.toUpperCase());
if(index==-1)
return false;
else
return true;
}
else
return true;
} | 2 |
public void openFacts(){
int returnVal = fileChooser2.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fileChooser2.getSelectedFile();
String filepath = file.getAbsolutePath();
factsLocation.setText(filepath);
try{
... | 6 |
public void generateComb2(ArrayList<ArrayList<Integer>> result,ArrayList<Integer> list,int[] num,int target,int index){
if (target == 0){
ArrayList<Integer> temp = new ArrayList<Integer>();
for (int i = list.size()-1;i>=0;i--){
temp.add(list.get(i));
}
... | 6 |
public String hornGen(){
rand = new Random();
int hornRoll = (rand.nextInt(100)+1);
if(hornRoll <= 40){
horn = "Silver";
} else if(hornRoll <= 75){
horn = "Brass";
} else if(hornRoll <= 90){
horn = "Bronze";
} else if(hornRoll <= 100){
horn = "Iron";
}
return horn;
} | 4 |
private DrawableTree phyloXMLToTree(org.w3c.dom.Document doc) throws FileParseException {
Node documentRoot = doc.getDocumentElement();
Node child = documentRoot.getFirstChild();
DrawableNode root = null;
//Search for (the first) phylogeny element
while(child != null) {
if (child.getNodeType() == Nod... | 8 |
public void deleteTask(jpvmTaskId tid) {
if(tasks == null) return;
jpvmTaskListRecord tmp = tasks;
// Check head
if(tmp.tid.equals(tid)) {
if (iter == tmp) iter=tmp.next;
tasks = tasks.next;
num_tasks --;
return;
}
// Check body
while(tmp.next != null) {
if(tmp.next.tid.equals(tid)) {
... | 6 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
WifiId other = (WifiId) obj;
if (BSSID == null)
{
if (other.BSSID != null)
return false;
}
else if (!BSSID.equals(other.BSSID))
... | 9 |
public Proceso(int pid, boolean esTiempoReal, int prioridadEstatica, ArrayList<Integer> tiempoCPU, ArrayList<Integer> tiempoIO, int tiempoEntrada) {
this.pid = pid;
this.esTiempoReal = esTiempoReal;
this.prioridadEstatica = prioridadEstatica;
this.tiemposCPU = tiempoCPU;
this.tie... | 4 |
private void moveDown() {
int[] rows = table.getSelectedRows();
DefaultTableModel model = (DefaultTableModel) table.getModel();
try {
if (model.getRowCount() >= 2) {
model.moveRow(rows[0], rows[rows.length - 1], rows[0] + 1);
table.setRowSelectionInterval(rows[0] + 1,
rows[rows.length - 1] + 1);
... | 2 |
public static long[] getKPrimes(int k, boolean print) {
long[] primes = new long[k];
primes[0] = 2;
int currPrimeCount = 1;
for(int i=3;currPrimeCount<k;i+=2) { // even number cannot be prime
boolean isPrime = true;
long sqrt = (long) Math.sqrt(i);
for(int j=0; j<currPrimeCount && primes[j]<=sq... | 6 |
public String getName() {
return name;
} | 0 |
@Override
public long split(long count, LongBitSet rightTree, PointWriter left, PointWriter right, boolean doClearBits) throws IOException {
if (left instanceof OfflinePointWriter == false ||
right instanceof OfflinePointWriter == false) {
return super.split(count, rightTree, left, right, doClearBi... | 9 |
protected void readAttribute(String name, int length, ConstantPool cp,
DataInputStream input, int howMuch) throws IOException {
if ((howMuch & KNOWNATTRIBS) != 0 && name.equals("ConstantValue")) {
if (length != 2)
throw new ClassFormatException("ConstantValue attribute"
+ " has wrong length");
int ... | 7 |
public void setCombination(int x, int y, int z){
if(x < 0 || x > dialSize){
throw new IllegalArgumentException(x +
" is not a valid combination number");
}else
this.x = x;
if(y < 0 || y > dialSize){
throw new IllegalArgumentException(y +
... | 7 |
private boolean inPoly(FastVector ob, double x, double y) {
int count = 0;
double vecx, vecy;
double change;
double x1, y1, x2, y2;
for (int noa = 1; noa < ob.size() - 2; noa += 2) {
y1 = ((Double)ob.elementAt(noa+1)).doubleValue();
y2 = ((Double)ob.elementAt(noa+3)).doubleValue();
if (... | 8 |
public void setExceptionHandlers(final Catch[] handlers) {
if (code != null) {
code.setExceptionHandlers(handlers);
}
} | 1 |
@Test
public void findHandFromCardSet_whenFlushOrStraightPossible_returnsFlush() {
Hand hand = findHandFromCardSet(sixFlushWithStraight());
assertEquals(HandRank.Flush, hand.handRank);
assertEquals(Rank.Jack, hand.ranks.get(0));
assertEquals(Rank.Ten, hand.ranks.get(1));
assertEquals(Rank.Nine, hand.ranks.ge... | 0 |
private void registerAll(final Path start) throws IOException {
// register directory and sub-directories
Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
throws IOExc... | 1 |
static boolean sqlQueryP(String sqlExpression) {
{ int start = 0;
int end = 0;
String operator = "";
while (Stella.$CHARACTER_TYPE_TABLE$[(int) (sqlExpression.charAt(start))] == Sdbc.KWD_WHITE_SPACE) {
start = start + 1;
}
end = start;
while (Stella.$CHARACTER_TYPE_TABLE... | 6 |
public boolean findAtNorth(int piece, int x, int y){
if(x==0 || b.get(x-1, y)==EMPTY_PIECE) return false;
else if(b.get(x-1, y)==piece) return true;
else return findAtNorth(piece,x-1,y); // there is an opponent
} // end findAtNorth | 3 |
public void dumpStrings(String filter) throws FileNotFoundException {
System.out.println("Dumping Strings");
PrintWriter writer = new PrintWriter("Ressources.txt");
for(Map.Entry<String,ArrayList<RAFFile>> file : archives.entrySet())
{
for(RAFFile rafFile : file.getValue()) ... | 4 |
public static double logNormalPDF(double mu, double sigma, double x) {
if (sigma < 0) throw new IllegalArgumentException("The parameter sigma, " + sigma + ", must be greater than or equal to zero");
if (x < 0) {
return 0.0D;
} else {
return Math.exp(-0.5D * Fmath.square((Math.log(x) - mu) / sigma)) / (x * s... | 2 |
private void doStuff(Point temp){
if(!ifOutOfMaze(temp)){
if(pathSize[temp.x][temp.y] == -1){
if(Game.get().level.getBlock(temp.x, temp.y).getType() == Block.AIR){
toCheck.add(temp);
}
for(Teleporter t : teleporters){
if(t.type.equals("in"))
toCheck.add(new Point(t.toX, t.toY));
}
... | 5 |
@Override
public void actionPerformed(ActionEvent e)
{
if(e.getSource().equals(playButton))
{
if(gui.getSimulator().isPaused())
{
if(gui.getSimulator().play())
{
playButton.setIcon(pauseIcon);
stepButton.setEnabled(false);
}
}
else
{
if(gui.getSimulator().pause())
{
... | 7 |
private List<T> calcPath(T start, T goal) {
// TODO if invalid nodes are given (eg cannot find from
// goal to start, this method will result in an infinite loop!)
LinkedList<T> path = new LinkedList<T>();
T curr = goal;
int i = 0;
boolean done = false;
while (!done) {... | 4 |
public int[] addInstance(BallNode node, Instance inst) throws Exception {
double leftDist, rightDist;
if (node.m_Left!=null && node.m_Right!=null) { //if node is not a leaf
// go further down the tree to look for the leaf the instance should be in
leftDist = m_DistanceFunction... | 7 |
@Override
public boolean selectFileToOpen(DocumentInfo docInfo, int type) {
// we'll customize the approve button
// [srk] this is done here, rather than in configureForOpen/Import, to workaround a bug
String approveButtonText = null;
// make sure we're all set up
lazyInstantiation();
// Setup the Fi... | 5 |
public void addPlayer(int playerID, String name, Team t) {
Area spawnArea = board.getSpawnArea(t);
Location spawnLoc = new NullLocation();
for (Tile tile: spawnArea.getTiles()) {
if (tile.isClear()) {
spawnLoc = tile.getCoords();
if (isFree(spawnLoc)) {
break;
}
}
}
server.queuePlayerUp... | 4 |
@Override
public void addExperienceRecord(StatisticDto statisticDto) {
if (warehouse.containsKey(statisticDto.userId)) {
List<StatisticDto> userRecords = warehouse.get(statisticDto.userId);
userRecords.add(statisticDto);
} else {
List<StatisticDto> userRecords = new ArrayList<StatisticDto>();
userReco... | 1 |
public int selectCount(BoardModel boardModel) {
int totalCount = 0;
String searchType = boardModel.getSearchType();
String searchText = boardModel.getSearchText();
String whereSQL = "";
try {
// 검색어 쿼리문 생성
if (!"".equals(searchText)) {
if ("ALL".equals(searchType)) {
whereSQL = " WHERE SUBJECT ... | 9 |
public boolean setPlayer1(Player p) {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: setPlayer1() BEGIN");
}
m_player1 = p;
if (test || m_test) {
System.out.println("FileManager :: setPlayer1() END");
}
return true;
} | 4 |
public void updateTxtBoard(String message){
txtBoard.append(message);
txtBoard.setCaretPosition(txtBoard.getDocument().getLength());
} | 0 |
private void btnEkleMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnEkleMousePressed
if(!btnEkle.isEnabled())
return;
HashMap<String, String> values = new HashMap<>();
values.put("ad", txtAd.getText().trim());
values.put("soyad", txtSoyad.... | 5 |
public void switchPhase(){
if(this.gamePhase!=null){
switch(gamePhase){
case BlockPhase1:
this.gamePhase = GamePhase.PowerupPhase;
break;
case PowerupPhase:
this.gamePhase = GamePhase.BlockPhase2;
break;
case BlockPhase2:
switchTurn();
this.gamePhase = GamePhase.BlockPhase1;
br... | 4 |
private void initialize(QuadTree quadTree, List<PolygonShape> landShapePolygons, List<PolygonShape> landUsePolygons)
{
quadTreeToDraw = quadTree;
visibleArea = new VisibleArea();
this.landShapePolygons = landShapePolygons;
this.landUseShapePolygons = landUsePolygons;
this.routeNodes = new ArrayList<>();
ti... | 1 |
public static String getString(Node node, String xpath) {
NodeList nodeList = getNodeList(node, xpath);
if (nodeList == null || nodeList.getLength() == 0) {
return "";
}
if (xpath.endsWith(ELEMENT_NAME_FUNC)) {
if (nodeList.getLength() > 0) {
ret... | 4 |
public AutomatonDrawer getDrawer() {
return pane.getDrawer();
} | 0 |
public int getFileIndex()
{
return fileIndex;
} | 0 |
@Override
public void run() {
initializeLogger();
this.log.fine("Start FileReceiver");
this.log.fine("Get current thread");
Thread currentThread = Thread.currentThread();
if (currentThread.isInterrupted()) return;
ServerSocket fileServerSocket = null;
try {
fileServerSocket = new ServerSocket(this.por... | 8 |
private void btnAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarActionPerformed
UsuarioSistema usuario = null;
UsuarioSistemaDAO daoUsuario = new UsuarioSistemaDAO();
try {
usuario = dao.Abrir(this.idUsuarioRemover);
} catch (Exception ex) {
... | 1 |
private boolean jj_2_5(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_5(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(4, xla); }
} | 1 |
public static Method findMethod(Class<?> clazz, String name, Object... args) {
if (args != null && args.length > 0) {
int size = args.length;
Class<?>[] argsClazz = new Class<?>[size];
for (int i = 0; i < size; i++) {
argsClazz[i] = args[i].getClass();
}
try {
return clazz.getMethod(name, argsC... | 9 |
public void alterar(Medico medicoAnt) throws Exception {
if(medicoAnt.getNome().isEmpty()){
throw new Exception("Nome Invalido !!");
}else{
this.verificarNome(medicoAnt.getNome());
}
if(medicoAnt.getCpf().equals(" . . - ")){
throw new Exception(... | 6 |
public static Set<String> getClassName(String packageName, boolean isRecursion) {
Set<String> classNames = null;
ClassLoader loader = Thread.currentThread().getContextClassLoader();
String packagePath = packageName.replace(".", "/");
URL url = loader.getResource(packagePath);
i... | 5 |
public static void main(String[] args) {
String s = "aaabbbbcccaab";
List<String> result = new ArrayList<String>();
for (int i = 0, j = i + 1, l = s.length(); i < l; i = j) {
char temp = s.charAt(i);
for (; j < l; j++) {
if (temp != s.charAt(j)) {
... | 7 |
public String loginAction() {
String returned = null;
FacesContext context = FacesContext.getCurrentInstance();
User user = userService.getUserByEmail(userName);
if (user == null){
user = userService.getUserByUserName(userName);
if (user == null){
context.addMessage(nul... | 7 |
node mutateRecurse(node nodeptr, doublePointer ratioptr , mutations newmuts,
double tree_age, double threshold, double loc)
{
node mutatenode = null;
if (nodeptr.getDescendents()[0] != null) {
if (segFactory.segContains(nodeptr.getDescendents()[0].getSegment(), loc)) {
double temp = (dou... | 8 |
public void requestBlock(int pieceIndex, int pieceOffset, int length) {
if (this.peer_choking) {
return;
}
// busy = true;
byte[] message = Message.buildRequest(pieceIndex, pieceOffset, length);
sendMessage(message);
// TODO
} | 1 |
protected void setLabel(String label)
{
/*
* The null check should not be needed as label should not be null
* so this is being too careful.
*/
if(label == null)
myLabel = "";
else
myLabel = label;
} | 1 |
public void maskRect(int x, int y, int w, int h, int[] pix, byte[] mask) {
assert data instanceof int[];
int maskBytesPerRow = (w + 7) / 8;
for (int j = 0; j < h; j++) {
int cy = y + j;
if (cy < 0 || cy >= height_)
continue;
for (int i = 0; i < w; i++) {
int cx = x + i;
... | 7 |
protected void multiply(int rows) throws MatrixIndexOutOfBoundsException {
//temporary variable
double temp = 0;
//It is one-tenth of the number of rows of the matrix
int stepProgress = rowsA / 10;
//this quantity of rows which the thread takes
int step = matrixA.getStepR... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ProductList other = (ProductList) obj;
if (maxIndex != other.maxIndex)
re... | 8 |
private float computeTempObj(List<JstatItem> subList, JvmModel fPhaseMax, Reducer fReducer) {
float tempObj = 0;
float shuffleBytesMB = (float) ((double)fReducer.getReducerCounters().getReduce_shuffle_raw_bytes() / (1024 * 1024));
JstatItem lastJstat = subList.get(subList.size() - 1);
if(lastJstat.getFGC() =... | 7 |
static final void method587(int i, int j, int k, int l, int i1, int j1, boolean flag, int k1, int l1, int i2) {
if (flag) {
method585(null, 72);
}
if (k == l && i == i1 && ~i2 == ~l1 && k1 == j1) {
Class1.method70(i, j1, i2, j, false, k);
return;
}
... | 6 |
private Expression matchDesignator(DesignatorType designatorType) {
dispatchEvent(ParserEvent.BEGAN_PARSING_NON_TERMINAL_SYMBOL, "Designator");
SyntacticValidator.getInstance().matchNextToken(ProductionRule.REQUIRED, Token.Type.IDENTIFIER);
SemanticValidator.getInstance().validateDeclarationIsNotAType(SemanticVa... | 7 |
@Override
public byte[] getContent() throws IOException {
if (content == null) {
try (BufferedInputStream is = new BufferedInputStream(fullUrl.openStream())) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int n;
byte[] data = new byt... | 2 |
public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
if (!ClassReader.ANNOTATIONS) {
return null;
}
ByteVector bv = new ByteVector();
// write type, and reserve space for values count
bv.putShort(newUTF8(desc)).putShort(0);
AnnotationWriter aw = new AnnotationWriter(thi... | 2 |
private void processSelectedKeys(Set keys) throws Exception {
Iterator itr = keys.iterator();
while (itr.hasNext()) {
SelectionKey key = (SelectionKey) itr.next();
if (key.isReadable()) processRead(key);
if (key.isWritable()) processWrite(key);
if (key.isC... | 5 |
private void sendGuessSet() {
Dot[] dots = guessSet.getDots();
boolean isInvalid = false;
// Check if dots in guess set are default color (not changed).
for (int i = 0; i < dots.length; i++) {
if (dots[i].getColor().equals(GameColor.DEFAULT.getColor()))
isInvalid = true;
}
// Send guess set to sess... | 7 |
public int getPlayerGem()
{
return karel.getGemCount();
} | 0 |
public void saveConfig() {
this.plugin.saveConfig();
} | 0 |
private ArrayList<Pawn> getAllPawn(Board board) {
ArrayList<Pawn> pawns = new ArrayList<Pawn>();
int numberOfPawns = board.numberOfPawns();
for (int i = 0; i < numberOfPawns; i++) {
pawns.add(board.getNextPawn());
}
return pawns;
} | 1 |
private void promoteAvatarToDrawable(List<DrawableAvatar> drawables,
int x, int y, int width, int height, int offset) {
double spacing = offset * avatarSpacing;
double avatarPosition = this.avatarPosition + spacing;
if (avatarIndex + offset < 0 ||
avatarIndex + offset >= avata... | 6 |
public void write(char[] b, int off, int len) throws IOException {
if (!initialized) {
area.setText("");
initialized = true;
}
// /#ifdef AWT10
// / area.appendText(new String(b, off, len));
// /#else
area.append(new String(b, off, len));
// /#endif
} | 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.