text stringlengths 14 410k | label int32 0 9 |
|---|---|
public List<Integer> topKFrequent(int[] nums, int k) {
Map<Integer,Integer> aux=new HashMap<>();
for(int i : nums){
Integer cnt=0;
if(aux.containsKey(i)) cnt=aux.get(i);
aux.put(i,++cnt);
}
PriorityQueue<Node> priorityQueue=new PriorityQueue<>();
... | 5 |
public ArrayList<Device> findDeviceByPower(int minPower, int maxPower) throws LogicException{
if (minPower > maxPower) {
LOG.error("Wrong searching options");
throw new LogicException("ERROR Min value can not be bigger then Max value");
}
ArrayList<Device> foundDevices ... | 5 |
public EditorPane getEditorPane() {
return editorPane;
} | 0 |
String dblfmt(double[] d) {
StringBuilder b = new StringBuilder();
for (int i = 0; i < d.length - 1; i++) {
b.append(String.format(Locale.US, fformat, d[i]));
b.append(',');
}
b.append(String.format(Locale.US, fformat, d[d.length - 1]));
... | 1 |
boolean isNextToARobot(Robot r, int x, int y) {
synchronized (robots) {
for (Robot robot : robots)
if (robot != r && robot.getX() == x && robot.getY() == y)
return true;
return false;
}
} | 4 |
@Override
public void loadReader(String name, Reader reader)
throws LevelLoaderException {
filename = name;
try {
xmlreader.parse(new InputSource(reader));
}
catch (SAXException e) {
throw new LevelLoaderException(e);
}
catch (IOException e) {
throw new LevelLoaderException(e);
}
catch (Num... | 3 |
public Zone getZone(int x, int y) throws OutOfBoundsException{
if (x < 0 || x >= this.width || y < 0 || y >= this.height)
throw new OutOfBoundsException();
return this.zones[x][y];
} | 4 |
int depthFirstCutValue(Edge edge, int count) {
Node n = getTreeTail(edge);
setTreeMin(n, count);
int cutvalue = 0;
int multiplier = (edge.target == n) ? 1 : -1;
EdgeList list;
list = n.outgoing;
Edge e;
for (int i = 0; i < list.size(); i++) {
e = list.getEdge(i);
if (e.tree && e != edge) {
co... | 8 |
public static OthelloBoardBinary getInitialBoard(){
OthelloBoardBinary board = new OthelloBoardBinary();
// FOLLOWING BINARIES REPRESENT INITIAL BOARD CONDITION
board.binHasDisk = 0x00_00_00_18_18_00_00_00l;
board.binIsBlack = 0x00_00_00_08_10_00_00_00l;
board.isBattingFirstTu... | 0 |
private void reportPath(String title, Route path) {
I.add(""+title+": ") ;
if (path == null) I.add("No path.") ;
else {
I.add("Route length: "+path.path.length+"\n ") ;
int i = 0 ; for (Tile t : path.path) {
I.add(t.x+"|"+t.y+" ") ;
if (((++i % 10) == 0) && (i < path.path.length... | 4 |
public final WaiprParser.stat_return stat() throws RecognitionException {
WaiprParser.stat_return retval = new WaiprParser.stat_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope globalstat54 =null;
ParserRuleReturnScope localstat55 =null;
try {
// Waipr.g:46:6: ( g... | 5 |
public static void g() throws MyException {
System.out.println("Throwing MyException from g()");
throw new MyException("Originated in g()");
} | 0 |
private void refreshModel(DefaultListModel model) {
if (model.equals(guestModel)) {
ArrayList<Guest> guestList;
guestList = ctr.getGuestsFromDB();
guestModel.clear();
for (int i = 0; i < guestList.size(); i++) {
guestModel.addElement(guestList.get(... | 4 |
public static Data data(String value)
{
Data data = null;
if (value.length() > 0)
{
if (value.charAt(0) == '[')
{
String content = value.substring(1, value.length() - 1);
try
{
int number = I... | 4 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new java... | 3 |
private void readStateMove(State[] states, BufferedReader reader)
throws IOException {
for (int i = 0; i < states.length; i++) {
int x, y;
String[] tokens = reader.readLine().split("\\s+");
try {
x = Integer.parseInt(tokens[1]);
y = Integer.parseInt(tokens[2]);
} catch (NumberFormatException e)... | 3 |
public void paintComponent(Graphics g) {
synchronized (LiveSystemCopyMutex) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.black);
g2d.fillRect(0, 0, panelWidth, panelHeight);
List<Ship> ships = p... | 7 |
public Main(final File file) {
try {
jmdns = JmDNS.create();
} catch (IOException e1) {
e1.printStackTrace();
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(... | 7 |
protected void onRemoveChannelBan(String channel, String sourceNick, String sourceLogin, String sourceHostname, String hostmask) {} | 0 |
public void removeOnetimeLocals() {
StructuredBlock[] subBlocks = getSubBlocks();
for (int i = 0; i < subBlocks.length; i++)
subBlocks[i].removeOnetimeLocals();
} | 1 |
private void calculate() throws Exception {
//Get B
Matrix diagonalizedMatrix = matrix.transpose().copy().times(matrix.copy()).copy();
//Diagonalize B
EigenvalueDecomposition ed = new EigenvalueDecomposition(diagonalizedMatrix);
//Get eigenvalues and sort them into ArrayLists
double[] eigenValues = ed.getRe... | 8 |
public static String[] convertUserInput(String input) {
assertNotNull("User input is null", input);
int index;
String temp1, temp2;
// preprocess of the input string to ease the progress of detecting
// deadline indicators which are "due at" and "due on"
if (input.contains(StringFormat.DUE_INDICATOR)) {
... | 9 |
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
if (par1World.getBlockMaterial(par3, par4, par5) != Material.water)
{
return false;
}
else
{
int var6 = par2Random.nextInt(this.radius - 2) + 2;
byt... | 7 |
@Override
public void valueUpdated(Setting s, Value v) {
if (s.getName().equals(Trigger)) {
try {
boolean b = v.getBoolean();
if (trigger_ == null && b) {
trigger_ = addInput(Trigger, ValueType.VOID);
trigger_.addListener(this);
} else if (trigger_ != null && !b) {
trigger_.removeListen... | 6 |
private boolean readHyphenatedWordBackwards()
{
boolean hadHyphen = false;
ArrayList<Character> saved = new ArrayList<Character>();
// check for page numbers
char token;
if ( readArabicPageBackwards()||readRomanPageBackwards() )
{
// remove page number
... | 6 |
private void writeEncoded(String str)
{
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
switch (c) {
case 0x0A:
this.writer.print(c);
break;
case '<':
this.writer.print("<");
break;
... | 9 |
private String getIPAddress() {
String ip = null;
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface
.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface iface = interfaces.nextElement();
if (iface.isLoopback() || !iface.isUp()
|| !iface.isPointT... | 7 |
public static Map<String,String> updateNamespaces( Object xmlPart, Map<String,String> previousNsAbbreviations ) {
if( !(xmlPart instanceof XMLOpenTag) ) return previousNsAbbreviations;
XMLOpenTag openTag = (XMLOpenTag)xmlPart;
Map<String,String> newNsAbbreviations = previousNsAbbreviations;
for( Iterator<String... | 6 |
public String getCountry() {
return country;
} | 0 |
public boolean contains(Object o) {
if (o == null)
return false;
int mask = elements.length - 1;
int i = head;
E x;
while ( (x = elements[i]) != null) {
if (o.equals(x))
return true;
i = (i + 1) & mask;
}
return ... | 3 |
public void insert(E element) {
heap.insert(element);
int i = heapSize;
while (i > 0 && heap.get(parent(i)).compareTo(element) > 0) {
swapElementsByIndex(i, parent(i));
i = parent(i);
}
heap.set(i, element);
heapSize++;
} | 2 |
double heuristicEstimation(int i, int j) throws Exception {
if (BitmapGraph.this.destI_pos == -1 || BitmapGraph.this.destJ_pos == -1) {
throw new Exception("heuristicEstimation failed! End point is not found!!");
}
//return 15*Math.sqrt(pow2(BitmapGraph.this.destI_pos... | 4 |
public static boolean createAssignExpression(InstructionContainer ic,
StructuredBlock last) {
/*
* Situation: sequBlock: dup_X(lvalue_count) store(POP) = POP
*/
SequentialBlock sequBlock = (SequentialBlock) last.outer;
StoreInstruction store = (StoreInstruction) ic.getInstruction();
if (sequBlock.subB... | 5 |
public PWWindow(PermWriter project) {
this.project = project;
this.setTitle("PermWriter");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.getContentPane().setLayout(new GridBagLayout());
this.setSize(750, 475);
} | 0 |
public boolean hasSingleFinalState(Automaton automaton) {
State[] finalStates = automaton.getFinalStates();
if (finalStates.length != 1) {
// System.err.println("There is not exactly one final state!");
return false;
}
State finalState = finalStates[0];
Transition[] transitions = automaton.getTransitio... | 3 |
public static List<Mouse> loadMice()
{
LinkedList<Mouse> mouseList = new LinkedList<>();
try (BufferedReader savedMice = new BufferedReader(new FileReader(
"mice.list")))
{
String mouseString;
while ((mouseString = savedMice.readLine()) != null)
{
if (mouseString.isEmpty())
{
continue... | 4 |
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e))
{
int x = (int)e.getPoint().getX();
int y = (int)e.getPoint().getY();
ActionJouer action = null;
if (x > 0 && x < 300 && y > 0 && y < 300) {
action = new ActionJouer(x/100, y/100);
m_view.sendActionToContro... | 5 |
private int clearAnswer() throws Exception
{
int n = 0;
while(n < this.MAX_TRIES && this.sendClearCommand() != 1)
{
if ( n > this.MAX_TRIES)
throw new Exception("Достигнут максимальный лимит попыток");
n += 1;
}
return 0;
} | 3 |
@Override
public void setValue(Object o) {
throw new UnsupportedOperationException("set replaygain not yet supported");
} | 0 |
private NoeudArbre recherchePrioriteList(double priorite) {
NoeudArbre result = NIL;
int i = 0;
while (result == NIL && i < listNoeudArbres.size()) {
if (listNoeudArbres.get(i).priorite == priorite) {
result = listNoeudArbres.get(i);
}
i++;
... | 3 |
public CheckResultMessage pass(String message) {
return new CheckResultMessage(message);
} | 0 |
private int pairIndex(int ii, int jj){
int ret = -1;
int i = 0;
boolean test = true;
while(test){
if(this.pairIndices[i][0]==ii && this.pairIndices[i][1]==jj){
ret = i;
test = false;
}
else{
if(this.pairI... | 6 |
public void tick()
{
super.tick();
if(this.fluidIn != null && this.fluidIn.getName().equals("water") && !hasAchievement(AchievementList.touchWater))
{
this.toggleAchievement(AchievementList.touchWater);
}
if(getHeldItem() != null)
{
getHeldItem... | 7 |
private static Item findClosestMatch(String input){
Levenshtein compare = new Levenshtein();
float max = 0.0f;
float comp;
Item maxitm = null;
for(Item item : items){
comp = compare.getSimilarity(input, item.name);
if(comp > max){
max = comp;
maxitm = item;
}
... | 2 |
public static void main(String[] args) {
List<Interval> result = new ArrayList<Interval>();
Interval a = new Interval(1,5);
Interval b = new Interval(6,8);
result.add(a);
result = new Insert_Interval().insert(result, b);
for(int i = 0 ; i< result.size();i++)
... | 1 |
protected boolean isLegalActionTiles(GameContext.PlayerView context,
Set<Tile> tiles) {
PlayerLocation location = context.getMyLocation();
if (!meetPrecondition(context)) {
return false;
}
int legalTilesSize = getActionTilesSize();
if (legalTilesSize > 0
&& (tiles == null || tiles.size() != legalTi... | 7 |
public void update(){
if(beginningAnimation){
AffineTransform transform = new AffineTransform();
transform.translate(WIDTH/2 - scaleFirst*WIDTH/2, HEIGHT/2 - scaleFirst*HEIGHT/2);
transform.scale(scaleFirst,scaleFirst);
Graphics2D g2d = (Graphics2D)beginningImage.getGraphics();
g2d.setRenderingHint(Ren... | 4 |
public static boolean Substring(String s1, String s2) {
boolean is_substring = true;
if (s2.length() > s1.length()) {
return false;
}
char[] input = s1.toCharArray();
char[] sub = s2.toCharArray();
for (int i = 0; i < input.length; i++) {
if (input[i] == sub[0] && (input.length - i > sub.length)) {
... | 6 |
public void setPostition(int[] newPos) {
this.position = newPos;
} | 0 |
public static int computeStorageClass (int tag)
{
switch (tag)
{
case T_BOOLEAN: case T_CHAR: case T_BYTE:
case T_SHORT: case T_INT:
return SC_INT;
case T_ARRAY: case T_CLASS:
case T_ADDR: case T_NULL:
return SC_ADDR;
default:
return tag;
}
} | 9 |
public static void tag(String catalogFile, String tagFile) {
ObjectOutputStream tagOutput = null;
try {
FileOutputStream fos = new FileOutputStream(tagFile);
BufferedOutputStream bos = new BufferedOutputStream(fos, 4096*4);
tagOutput = new ObjectOutputStream(bos);
... | 6 |
private void updateSpelprojektInPanel() {
tfSpelprojectSearch.setEnabled(false);
PanelHelper.cleanPanel(spelprojectHolderPanel); // do some cleanup before
ArrayList<String> matches = fetchMatchingSpelproject();
if (!matches.isEmpty()) {
for (String st : matches) {
... | 6 |
public int compareTo(Element element)
{
int myCharge = this.getCharge(getName(), protons);
int otherCharge = element.getCharge();
if (myCharge == otherCharge)
return 0;
else if (myCharge > otherCharge)
return 1;
else
return -1;
} | 2 |
@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 Company)) {
return false;
}
Company other = (Company) object;
if ((this.id == null && other.id != null) || (thi... | 5 |
protected void setCod(String cod) throws Exception{
if(cod.length()<5 || cod.length()>20){
throw new Exception("El codigo tiene que tener minimo 5 caracteres y menos de 20 caracteres.");
}else{
this.cod = cod;
}
} | 2 |
public static ErrorLogs parameterLogs(String supMsg, String confMsg){
ErrorLogs logs = new ErrorLogs();
String parameterError = "Parameter Input Error: ";
String parameterRange = " Must be between 0.0 and 1.0, inclusively";
if (!supMsg.equals("")) {
logs.getErrorMsgs().add(
parameterError + " Min Suppor... | 2 |
public static void roverChange(){
rover = head;
while(rover!=null){
if(rover.img.endsWith(".jpeg")){
String holder = rover.img;
String temp = changeExtension(holder);
System.out.println(temp);
rover.img = temp;
}
rover = rover.next;
}
} | 2 |
void hitmiss(int xe, int ye, int [][] pixel2, int [][]pixel, int [] lut){
int x, y;
// considers the pixels outside image to be 0 (not set)
for (x=1; x<xe-1; x++) {
for (y=1; y<ye-1; y++) {
pixel[x][y]+= lut[(
pixel2[x-1][y-1] +
pixel2[x ][y-1] * 2 +
pixel2[x+1][y-1] * 4 +
pixel2[x-1][y ]... | 6 |
public static List<TaskWorker> configRunners(DeployConfig config, String taskId, boolean undo) {
List<TaskWorker> result = new ArrayList<TaskWorker>();
boolean flag = true;
Task task = config.getTasks().getTaskById(taskId);
List<Server> servers = parseServers(config, task.getTargetServer());
... | 2 |
@Override
public void buttonPressed(ClickableComponent button) {
if (button instanceof LevelButton) {
LevelButton lb = (LevelButton) button;
TitleMenu.level = levels.get(lb.getId());
if (activeButton != null && activeButton != lb) {
activeButton.setActive(false);
}... | 7 |
@EventHandler
public void GiantFastDigging(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getGiantConfig().getDouble("Giant.FastDi... | 6 |
public final Customer getCustomer(String custID) {
Customer customer = null;
for (Customer c : customers) {
if (custID.equals(c.getCustID())) {
customer = c;
break;
}
}
return customer;
} | 2 |
protected final String getCommand() throws MenuException{
// Scanner inFile = Memorygame.getInputFile();
Scanner inFile = new Scanner(System.in);
String command;
boolean valid = false;
do {
command = inFile.nextLine();
command = command.trim().toUpperCase... | 2 |
private void formUserList(SessionRequestContent request) throws ServletLogicException {
Criteria criteria = new Criteria();
User user = (User) request.getSessionAttribute(JSP_USER);
if (user != null) {
ClientType type = ClientTypeManager.clientTypeOf(user.getRole().getRoleName());
... | 2 |
public boolean isCellEditable(int row, int column) {
if (!finalEdit)
return super.isCellEditable(row, column);
column = convertColumnIndexToModel(column);
return cellEditors[row][column] != null;
} | 1 |
public static Slot lookupVisibleSlot(Stella_Class renamed_Class, Stella_Object slotName) {
{ Slot slot = null;
String slotnamestring = null;
Module module = ((Module)(Stella.$MODULE$.get()));
{ Surrogate testValue000 = Stella_Object.safePrimaryType(slotName);
if (Surrogate.subtypeOfSymbo... | 7 |
private List<FactoryPoint<?>> findAllFactoryPoints(final List<Member> allMembers, final List<Method> allMethods,
final BeanKey factoryBean, final TypeMap typeMap) {
final List<FactoryPoint<?>> factoryPoints = new ArrayList<FactoryPoint<?>>();
for (... | 8 |
public Value naryOperation(final AbstractInsnNode insn, final List values) {
int size;
if (insn.getOpcode() == MULTIANEWARRAY) {
size = 1;
} else {
size = Type.getReturnType(((MethodInsnNode) insn).desc).getSize();
}
return new SourceValue(size, insn);
... | 1 |
public void setFunEstado(String funEstado) {
this.funEstado = funEstado;
} | 0 |
public void visitTableSwitchInsn(
final int min,
final int max,
final Label dflt,
final Label[] labels)
{
buf.setLength(0);
buf.append(tab2).append("TABLESWITCH\n");
for (int i = 0; i < labels.length; ++i) {
buf.append(tab3).append(min + i).append(... | 2 |
protected void stopPlayer() throws JavaLayerException
{
if (player!=null)
{
player.close();
player = null;
playerThread = null;
}
} | 1 |
@SuppressWarnings("deprecation")
public ConfigAccessor(JavaPlugin plugin, String fileName) {
if (plugin == null) {
throw new IllegalArgumentException("plugin cannot be null");
}
if (!plugin.isInitialized()) {
throw new IllegalArgumentException("plugin must be initialized");
}
this.plugin = plugin;
th... | 3 |
public void declareSplitWinnings(int dealer, int player, int split) {
int winnings = 0;
if (playerHand.blackJack()) {
winnings += playerHand.getBet() + (playerHand.getBet() * 3) / 2;
} else if (player > dealer) {
winnings += playerHand.getBet() * 2;
} else if (pla... | 7 |
protected static BigDecimal parseBigDecimal(final Object obj, final String type) throws ParseException {
final BigDecimal result;
try {
result = new BigDecimal(obj.toString());
} catch (NumberFormatException nfe) {
throw new ParseException(obj + " is not a valid " + type + ".");
}
return... | 1 |
public Set<String> copySet(Set<String> set) {
Set<String> out = new HashSet<String>();
for (String elem : set) {
out.add(elem);
}
return out;
} | 1 |
private void createInterface() {
boolean b = true;
for (int i = 0; i < model.getTabellone().length; i++) {
for (int j = 0; j < model.getTabellone()[i].length; j++) {
Cell cell = new Cell(i, j);
if (b) {
cell.setImage(whiteCell.getImage());
... | 8 |
public EditorTab() {
this.setLayout(new BorderLayout());
this.list.setCellRenderer(this.renderer);
this.list.setTransferHandler(new BytecodeEditorTransferHandler(this));
ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
toolTipManager.registerComponent(this.list);
this.add(this.l... | 9 |
public RedeclarationError(Symbol sym)
{
super("Symbol " + sym + " being redeclared.");
} | 0 |
@Override
public void run() {
HashMap<String, String> args = msg.getArgs();
String ip = socket.getInetAddress().toString();
String username = args.get("username");
String password_ = args.get("password");
DebugLog.log("login", username);
String password = null;
try {
password = DaoFactory.cre... | 7 |
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
try {
long id = Long.parseLong(jTextField1.getText());
long tel = Long.parseLong(jTextField5.getText());
String nome = ... | 2 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... | 8 |
private void checkCollision()
{
for (int i = 0; i < traps.size(); i ++) {
Trap t = traps.get(i);
if (t.functioning) {
double distance = player.pos.x - t.pos.x;
if (distance < 10 && distance > - 5) {
if (player.state != Player.STATE.JUMPING || (player.state == Player.STATE.JUMPING && (player.getJum... | 8 |
public void compFinalResult() {
do {
iStage++;
compAllocation();
if (compDistribution()) {
/* deadline can not be satisfied */
if (!bDeadline) {
System.out.println("THE DEADLINE CAN NOT BE SATISFIED!");
return;
} else {
System.out.println("\nNEW ROUND WITHOUT CHECKING:");
dEv... | 7 |
public static String BigIntMultDif(String a, String b, int intLevel) {
int k1 = a.length();
int k2 = b.length();
StringBuffer strLevel = new StringBuffer("\n");
for (int i = 0; i < intLevel; i++) {
strLevel.append(" ");
}
if (k1 < 4 && k2 < 4) {
i... | 7 |
@Override
public TestResult test(String input, Integer... args) {
if( !String.class.equals(input.getClass()) ){
throw new IllegalArgumentException("Parameter 'input' ONLY support 'String' type.");
}
final int length = input.length();
final int minLength = args[0];
final int maxLength = args[1];
bo... | 3 |
public int compareChromoName(Interval interval) {
Chromosome i2 = (Chromosome) interval;
// Both of them are non-numeric: Compare as string
if ((chromosomeNum == 0) && (i2.chromosomeNum == 0)) return id.compareTo(i2.id);
// One of them is a number? => the number goes first
if ((chromosomeNum != 0) && (i2.ch... | 8 |
public boolean escribirCliente (int i,CCliente cliente){
if(i>=0 && i<= nregs){
try{//uso try porque puede generar errores
fes.seek(i*tam); //situamos el puntero en la posición que me indica i (será nregs*tamaño de cada registro)
fes.writeUTF(cliente.getDN... | 3 |
public synchronized Connection get() throws DataException {
// ensure we haven't used too many connections
if (usedConnections.size() >= MAX_CONNECTIONS) {
throw new DataException("The database connection pool is out of connections -- a maximum number of " + MAX_CONNECTIONS);
}//if
try {
... | 3 |
public void onReceivePushSolution(RepairSolution solution) {
logger_.info("Solution for path {} received.", solution.failedPath);
// Update routing table.
for (PeerReference ref : solution.failedHosts) {
Host failedHost = Deserializer.deserializeHost(ref);
logger_.debug(... | 7 |
public static TreeNode commonAncestor(TreeNode root, int childOne, int childTwo) {
if (root == null)
return null;
if (childOne == root.value || childTwo == root.value)
return root;
TreeNode left = commonAncestor(root.left, childOne, childTwo);
TreeNode right = commonAncestor(root.right, childOne, ch... | 6 |
@Override
public boolean equals(Object other){
if(other instanceof HttpResponse){
HttpResponse otherResponse = (HttpResponse) other;
if(header == null)
return statusCode == otherResponse.statusCode &&
body.equals(otherResponse.body);
... | 7 |
public static List<String> generateAllSentencesWithAllDefinitions(GRESCTask task) {
List<String> pSentences = new ArrayList<String>();
List<GRESCOption> options = task.getOptions().get(0);
for (GRESCOption option : options) {
String sentence = task.getSentence().replaceAll("%s", "\\(%s\\)");
String formatte... | 9 |
@Override protected boolean canFigureMove(Point x, Point Abs) {
if ((x.x==1*getFI() || (x.x == 2*getFI() && isFirstMove)) && x.y == 0)
if (!C.isFigure(Abs) && x.x == 1*getFI() || !C.isFigure(Abs) &&
!C.isFigure(new Point(Abs.x-getFI(),Abs.y)) && x.x == 2*getFI())
ret... | 9 |
@Override
public void paint(Graphics g) {
Dimension currentSize = getSize();
Dimension maximumSize = getMaximumSize();
if (currentSize.width > maximumSize.width || currentSize.height > maximumSize.height) {
currentSize.width = Math.min(maximumSize.width, currentSize.width);
... | 2 |
public static UDPChat getInstance()
{
return instance;
} | 0 |
@Override
public void run() {
if (state == GameState.Running) {
while (true) {
robot.update();
if (robot.isJumped()) {
currentSprite = characterJumped;
} else if (robot.isJumped() == false
&& robot.isDucked() == false) {
currentSprite = anim.getImage();
}
ArrayList<Projectile>... | 9 |
@Override
public Parameter getParameter(final int parameterIndex) {
Parameter parameter;
switch (parameterIndex) {
case 0:
parameter = effect1On;
break;
case 1:
parameter = effect2On;
break;
case 2:
... | 8 |
@EventHandler(priority = EventPriority.NORMAL)
public void onEntityDeath(EntityDeathEvent event) {
if (event.getEntityType() == EntityType.PLAYER) {
Player player = (Player) event.getEntity();
RemovePlayer(player);
}
if (event instanceof PlayerDeathEvent) {
PlayerDeathEvent e = (PlayerDeathEvent) event... | 2 |
public static int lengthOfLongestSubstring(String s) {
if(s.equals("")) {
return 0;
}
HashMap<String, Integer> table = new HashMap<String, Integer>();
int tmpLen = 0;
int maxLen = 0;
int start = 1;
String[] subStrings = s.split("");
int len = subS... | 7 |
public void run() {
InetAddress group = null;
try {
group = InetAddress.getByName(multicast);
} catch (UnknownHostException e) {
e.printStackTrace();
}
//create Multicast socket to to pretending group
MulticastSock... | 8 |
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.