text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Constant newUTF8(final String value) {
key1.set('s', value, null, null);
Constant result = get(key1);
if (result == null) {
result = new Constant(key1);
put(result);
}
return result;
} | 1 |
private static void requestAndParseAllMeasurementsBelongingToExactGSMCells() {
String fileName = "/Users/Johan/Documents/CellTowers/cell_towers_GSM_exact.csv";
try(BufferedReader br = new BufferedReader(new FileReader(fileName));){
String line = "";
int totalCount = 0;
int count = 0;
JSONFile jsonFile... | 7 |
public Command recv (long timeout_)
{
Command cmd_ = null;
// Try to get the command straight away.
if (active) {
cmd_ = cpipe.read ();
if (cmd_ != null) {
return cmd_;
}
// If there are no more commands avai... | 3 |
private Set<Card> sevenFlush() {
return convertToCardSet("2S,6S,8S,3S,9S,KS,JS");
} | 0 |
public void render(){
BufferStrategy bs = getBufferStrategy();
if(bs == null){
createBufferStrategy(3);
return;
}
int xOffset = player.x-screen.width/2;
int yOffset = player.y-screen.height/2;
level.renderTiles(screen, xOffset, yOffset);
for(int x=0; x<level.width;x++){
int color = Colors.get(... | 7 |
public void prepare(Dish dish) {
LinkedList<Material> materials = dish.getMaterials();
for (Material tmp : materials) {
for (StorageAdapter storage : storageList) {
if (tmp.getName().equals(storage.getName())) {
storage.setAmount(storage.getAmount() - tmp.getAmount());
}
}
}
LinkedList<Ingr... | 7 |
public void getInput()
{
while (Keyboard.next())
{
//if(!chatMode){
if(getStats().isAlive())
{
if(Keyboard.isKeyDown(Keyboard.KEY_A))
{
movx = MOVE_LEFT;
spr.setAnimation(1)... | 9 |
public static boolean testPropertyP(Stella_Object self, Surrogate relation) {
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_TEST_PROPERT... | 7 |
private void searchGoodWord(List<String> words) {
if(words != null && !words.isEmpty()) {
List<Keyword> keywordList = dictionary.getKeywordList();
int priority = -1;
float distance = 1;
int elementId = -1;
int elementIdRegardingDistance = 0;
for(int i = 0; i < words.size(); i++) {
String[] p... | 9 |
public void move() throws Exception {
rightPressed = false;
View.count++;
int timer = 100;
int result = 0;
int divider = 0;
System.out.println("Dragged method running");
OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0);
grabber.start();
//Create canvas frame for displaying we... | 7 |
public Instruction findMatchingPop() {
int poppush[] = new int[2];
getStackPopPush(poppush);
int count = poppush[1];
Instruction instr = this;
while (true) {
if (instr.succs != null || instr.doesAlwaysJump())
return null;
instr = instr.nextByAddr;
if (instr.preds != null)
return null;
in... | 5 |
public int compareTo(Object b)
{
if (getClass() == b.getClass())
{
EventModel a = (EventModel) b;
if (year > a.year)
{
return 1;
}
if (year < a.year)
{
return -1;
}
if (mon... | 9 |
private TransformNode createNode(String className)
throws ClassNotFoundException {
TransformNode tr = null;
if (ConnectNode.class.getName().equals(className)) {
tr = soundProcessor.createConnectNode();
} else if (EchoNode.class.getName().equals(className)) {
tr = soundProcessor.createEchoNode();
} else... | 9 |
public static void main(String[] args) {
boolean timeToExit = false;
do {
System.out.println("Выберите действие: ");
System.out.println("1. Create");
System.out.println("2. Link");
System.out.println("3. Unlink");
System.out.println("4. Message... | 8 |
public static boolean checkRoot(String filename) {
File[] roots = File.listRoots();
for (File root : roots) {
try {
String canonicalRoot = root.getCanonicalPath().toLowerCase();
if (filename.toLowerCase().startsWith(canonicalRoot)) {
retur... | 3 |
public static void main(String... args)
{
ConstructorReferenceSAM<ConstructorReference> constructorReference = ConstructorReference::new;
System.out.println(constructorReference.whatEverMethodIs().getContent());
ConstructorReferenceSAMWithArgs<ConstructorReference,String> constructorRefere... | 0 |
private boolean isEnpassant(Position checkedPos, Position beside) {
if(!(isValidPos(checkedPos)||isEmptyPlace(checkedPos))) return false;
if(!isEmptyPlace(beside)&&!isSameTeam(beside)&&Board.chessBoard.get(beside).moveCount==1) return true;
return false;
} | 5 |
public static String generateCard() {
String temp = new String();
String newCard = new String();
int tmp;
Random rand = new Random();
int cardDigits[] = new int[16];
// For AmericanExpress 1st digit is always 3, 2nd digit is 7
cardDigits[0] = 3;
cardDigits[1] = 4+3*rand.nextInt(2);
newCard += cardDi... | 5 |
@Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.hotels");
String prevPage = (String) request.getSessionAttribute(JSP_PAGE);
resaveParamsShowHotel(request);
formHotelList(r... | 2 |
public MainFrame() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
User user = Service.getCurrentUser();
this.setTitle("Carletti Production Manager - " + user.getUsername()
+ " (" + user.getGroup() + ")");
this.setResizable(true);
this.setSize(600, 500);
this.setMinimumSize(new Dimension(500, 450... | 5 |
public boolean getGenericPortMappingEntry(int index,
final PortMappingEntry portMappingEntry)
throws IOException, SAXException {
Map<String, String> args = new HashMap<String, String>();
args.put("NewPortMappingIndex", Integer.toString(index));
... | 4 |
public void addToStart(String value) throws AlreadyExist {
ListElement current = new ListElement(value);
if (count == 0) {
head = current;
tail = current;
} else {
current.connectNext(head);
head = current;
}
count++;
} | 1 |
public static void main(String[] args) {
// wap to take input from user and display the pattern according to value
/*
2 **
3 ***
9 *********
1 *
*/
int[] arInt=new int[]{2,7,9,11};
for (int j = 0; j < arInt.length; j++) {
... | 2 |
protected void loadAllManufacturers()
{
final String filename=getManufacturersFilename();
CMFile xmlFile=new CMFile(filename, null, CMFile.FLAG_FORCEALLOW);
if((!xmlFile.exists())||(!xmlFile.canRead()))
xmlFile=new CMFile("/resources/examples/manufacturers.xml", null, CMFile.FLAG_FORCEALLOW);
manufacturers.... | 8 |
@Override
public void run() {
while (n < 2000) {
try {
// this will load the MySQL driver, each DB has its own driver
Class.forName("com.mysql.jdbc.Driver");
// setup the connection with the DB.
connect = DriverManager.getConnec... | 3 |
public RockEntity(double x, double y, double dx, double dy, int width, int height, int size, int type, double gridSize, double spawnTimer) {
this.x = x;
this.y = y;
this.dx = dx;
this.dy = dy;
this.width = width;
this.height = height;
this.size = size;
thi... | 8 |
private static boolean canSearch(Object o) {
return o != null && !(o instanceof Reference);
} | 1 |
private void writeOut(String output) {
String myName = dir.getName();
File out = new File(output + File.separator + myName);
if (!out.exists()) {
out.mkdir();
}
for (DirManager manager : subDirs) {
manager.writeOut(output + File.separator + myName);
}
for (Clazz clazz : classes.values()) {
clazz.... | 3 |
String getSlip() {
return id;
} | 0 |
private Set<TKey<?, ?>> setupPortalKeys() {
Set<TKey<?, ?>> portalKeys = new LinkedHashSet<>();
portalKeys.add(ProviderKeys.PORTAL_STATUS);
portalKeys.add(ProviderKeys.COORDINATE);
portalKeys.add(ProviderKeys.LINK);
validQualifiers.put(ProviderKeys.LINK, new LinkedHashSet<Class... | 6 |
public String getPostalCode() {
return Address.getPostalCode();
} | 0 |
@Override
public void setMiscText(String text)
{
super.setMiscText("");
slots = new Item[0];
slotProps = new Ability[0];
String itemXml = "";
int x=text.indexOf(';');
if(x >=0)
{
itemXml = text.substring(x+1).trim();
text = text.substring(0,x).trim();
}
int numSlots = CMParms.getParmInt(text,... | 9 |
private void loadState() throws IOException
{
try
{
String path = CA_PERSISTENCE_PATH + File.separator + CA_ID;
File nodeFile = new File(path);
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(nodeFile));
CA ca = (CA) ois.readObject();
if (ca.getUserId() != null && ca.getSecurityAge... | 6 |
public void renderAddonsTile()
{
for(Interactable i: addons)
{
if(i.isVisible())
{
int [] image = i.getCurrentPixelArray();
for(int xx=0;xx<i.getWidth();xx++)
{
for(int yy=0;yy<i.getHeight();yy++)
{
if(i.getY()+yy>=0 && i.getY()+yy<height && i.getX()+xx>=0 && i.getX()+xx<width && ... | 9 |
@Override
public O train(I input) throws Exception {
Object i = input;
for(final Processor p : processors){
p.setContext(context);
context.getProgressReporter().reportProgress(p.getClass().getSimpleName() + " train: ", 0);
long t0 = System.currentTimeMillis();
... | 5 |
private boolean isPassableFromTo(int fromx,int fromy, int tox,int toy) {
int tileFrom = mapSteps[fromx][fromy];
int tileTo= mapSteps[tox][toy];
int curTileSet = curGb.readMemory(curGb.pokemon.curTilesetAddress);
for(int c = curGb.pokemon.tilePairCollisionsLandAddress; memory[c] != 0xFF; c+=3) {
if(memory[c] ... | 6 |
public void readResults() {
String saveFile = saveFileName + ".xrsbxl2x";
ReadFile read = new ReadFile("./Results/" + saveFile);
List<String> readLines = new ArrayList<>();
try {
Collections.addAll(readLines, read.OpenFile());
} catch (IOException ex) {
Sy... | 2 |
public synchronized static String inputNotation(int move) {
// Gather the information from the move int
int fromIndex = fromIndex(move);
int toIndex = toIndex(move);
int moveType = moveType(move);
StringBuilder inputNotation = new StringBuilder();
positionToString(fromIndex, inputNotation);
positionToSt... | 4 |
@Override
public void valueChanged(TreeSelectionEvent arg0) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (node == null) return;
if (node.isLeaf()) {
if (prevNode != null) {
detectChange();
}
tabbedPane.removeAll();
listOfColumns.clear();
G... | 8 |
public void moveEnemy(int x, int y, Point enemyToMove) {
Point newLocation = new Point((int) (enemyToMove.getX() + x), (int) (enemyToMove.getY() + y));
GridSpace gs = grid.get(enemyToMove);
GridSpace gs2 = grid.get(newLocation);
if (gs.returnLivingThings().get(0).isFrozen()) {
return;
}
// if (this.chara... | 8 |
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3 && label.getOnCanvas()) {
label.erase(canvas.getCurrentLayer());
} else if (e.getButton() == MouseEvent.BUTTON1 && label.getOnCanvas()) {
label.drawTile(canvas.getCurrentTile(), canvas.... | 5 |
public Environment(Strategy strategy){
this.strategy = strategy;
} | 0 |
public int getBonusScore (int numOfFrame){
int bonusFirst;
int bonusSecond;
if(numOfFrame==currentFrame-1)
return 0;
if(scoreBoard[numOfFrame].checkStrike()){
if(numOfFrame==currentFrame-2 && currentRoll%2==1)
return 0;
bonusFirst = scoreBoard[numOfFrame+1].getFirstPoint();
if(bonu... | 7 |
private boolean blockBlocksFlow(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockId(par2, par3, par4);
if (var5 != Block.doorWood.blockID && var5 != Block.doorSteel.blockID && var5 != Block.signPost.blockID && var5 != Block.ladder.blockID && var5 != Block.reed.blockID)
... | 7 |
private void parser(final Element e) {
// Extract the information according to the question's type
switch ((String) e.getAttributeValue("type")) {
case "truefalse":
TrueFalse tf = new TrueFalse(e.getChild("name")
.getChildText("text"), e.getChild("questiontext")
.getChildText("text"), e.getChild("que... | 9 |
public void update(double deltaTime){
// If the display has been resized, move all elements belonging to this CompositeElement into the same relative position.
// i.e. if CompositeElement is at bottom right of screen, after resizing will still be at bottom right of screen.
if(Display.wasResized()){
for (GUIEle... | 6 |
private void initialize() {
gameFrame = new JFrame();
gameFrame.setTitle("Hand and Foot");
gameFrame.setBounds(0, 0, 800, 500);
gameFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
gameFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
exit(... | 7 |
protected static void addFileNameToList(DocumentInfo docInfo) {
// check to see if this file is in frameInfoList
int position = NOT_THERE;
String filename = PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_PATH);
for (int i = 0, limit = frameInfoList.size(); i < limit; i++) {
if (Pr... | 4 |
private JMenuItem getPatternLengthItem() {
if (patternLengthItem == null) {
patternLengthItem = new JMenuItem();
patternLengthItem.setText("Set Pattern Length...");
patternLengthItem.setMnemonic(KeyEvent.VK_L);
patternLengthItem.addActionListener(new java.awt.event.ActionListener() {
public void actio... | 7 |
@Override
public void documentRemoved(DocumentRepositoryEvent e) {} | 0 |
@Override
public void execute(VirtualMachine vm) {
for (int i = 0; i < levelsOfStackToPop; i++) {
vm.popRunTimeStack();
}
} | 1 |
private static int[] readHeuristics(int h, String fileName) {
// Our corners heuristics array will have 88179840
// elements, but not all of them will have a value
// as we only calculated heuristics for valid corner
// positions starting at the goal state rather than
// all possible permutations of corners.
... | 7 |
@SuppressWarnings("unchecked")
void setLineBits(float dx, float dy) {
slope = (dx != 0 ? dy / dx : dy >= 0 ? Float.MAX_VALUE : -Float.MAX_VALUE);
lineTypeX = (slope <=1 && slope >= -1);
lineDirection = (slope < 0 ? -1 : 1);
if (getCachedLine())
return;
nBits = (lineTypeX ? g3d.width : g3... | 9 |
public void inicio(FonteFinanciamento fontefinanciamento) throws Exception
{
salvar = new JButton("Salvar");
id = new JTextInt(fontefinanciamento.getId());
id.setEditable(false);
id.setEnabled(false);
nome = new JTextField(fontefinanciamento.getNome() == null ? ""
: fontefinanciamento.getNome());
JPan... | 1 |
public void kill() {
if (killState.compareAndSet(false, true)) {
try {
socket.close();
} catch (IOException e) {/*NOP*/}
threadGroup.interrupt();
try {
deathQueue.put(name);
} catch (InterruptedException e) {/*NOP*/}
... | 3 |
public void show() {
int choice;
boolean tryAgain;
do{
System.out.print("Enter Username: ");
username = ConsoleReader.readString();
System.out.print("Enter Password: ");
password = ConsoleReader.readString();
tryAgain = !staffBL.isValid(username, password);
if(tryAgain) {
System.... | 7 |
private static void setLookAndFeel() {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) { // Windows
javax.swing.UIManager.setLookAndFeel(info.getClassName());... | 3 |
@Override
public void update()
{
yy++;
if(yy < 60) {
y += 0.2632;
}
else if(yy > 60 && yy < 120) {
y -= 0.2632;
}
if(yy > 120) {
yy = 0;
}
} | 4 |
private static SAMFileHeader mergeHeaders(List<RecordSource> sources) {
SAMFileHeader header = new SAMFileHeader();
for (RecordSource source : sources) {
SAMFileHeader h = source.reader.getFileHeader();
for (SAMSequenceRecord seq : h.getSequenceDictionary().getSequences()) {
if (header.getSequenceDiction... | 8 |
private static int toIndex(Direction dir) {
switch(dir) {
case SOUTH: return 0;
case NORTH: return 1;
case WEST: return 2;
case EAST: return 3;
}
return 0;
} | 4 |
public boolean equals(Object obj) {
if (obj == this)
return true;
if (obj != null && obj instanceof Reference) {
Reference tmp = (Reference) obj;
return (tmp.objf == objf) && (tmp.genf == genf);
}
return false;
} | 4 |
public Capture nextCapture (Position position){
FactoryOfCapturingsForCpuForPiece factory = new FactoryOfCapturingsForCpuForPiece(position,this,largestCapture);
return (Capture) factory.getBest();
} | 0 |
public void reset() {
try {
// reseting non cached byte stream
if (byteArrayInputStream != null) {
byteArrayInputStream.reset();
}
// reseting cached byte stream
if (fileInputStream != null) {
fileInputStream.close();
... | 3 |
public OpenFileMenuItem(FileProtocol protocol) {
setProtocol(protocol);
addActionListener(this);
} | 0 |
public static void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative");
if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative");
double xs = s... | 4 |
String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... | 7 |
private void setPrecision() {
int firstPos = pos;
precisionSet = false;
if (pos<fmt.length()&&fmt.charAt(pos)=='.') {
pos++;
if ((pos < fmt.length())
&& (fmt.charAt(pos)=='*')) {
pos++;
if (!setPrecisionArgPosition()) {
variablePrecision = true;
... | 8 |
public static void main(String[] args) throws RemoteException {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
System.out.println("Hello World! salut didier\n");
// EntityManager em = Persistence.createEntityManagerFacto... | 5 |
private void initMenu()
{
JPanel titlePanel = new JPanel();
this.add(titlePanel);
JLabel title = new JLabel("Card Counting Training");
titlePanel.add(title);
JPanel inputPanel = new JPanel();
this.add(inputPanel);
input = new JTextField(2);
input.setT... | 1 |
public void ajoutNiemeListeMetadonnee(int n, Metadonnee m) {
listeMetaDonnees.add(n, m);
} | 0 |
private boolean r_case_other() {
int among_var;
// (, line 123
// [, line 124
ket = cursor;
// substring, line 124
among_var = find_among_b(a_6, 6);
if (among_var == 0) {
return false;
}
// ], line 124
bra = cursor;
// call R1, line 124
if (!r_R1()) {
return false;
}
switch (among_var)... | 7 |
private void createSysTrayIcon()
{
sysTrayIconVisible=true;
//Check the SystemTray is supported
if (!SystemTray.isSupported()) {
log("SystemTray is not supported."); //$NON-NLS-1$
return;
}
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e1) {
e1.p... | 3 |
public static synchronized boolean allowcateUser(Object instance,
Object[] users) {
for (int i = 0; i < users.length; i++) {
if (users[i] == null) {
users[i] = instance;
return true;
}
}
// could not allocate space for user
return false;
} | 2 |
public static void main(String[] args) {
RandomSearchInitialisation starter = new RandomSearchInitialisation();
starter.initLanguage(new char[] { 'a', 'b' }, 10, "[ab]*abab");
int solutionFoundCounter = 0;
int noSolutionFound = 0;
List<Long> cycleCount = new LinkedList<Long>();
long tmpCycle;
long timeSt... | 8 |
@Subscribe
public void logout(PlayerDisconnectEvent event) throws SQLException {
if(!plugin.chatEnabled)return;
String name = event.getPlayer().getName();
if(name==null){
for(String data:plugin.onlinePlayers.keySet()){
if(plugin.getProxy().getPlayer(data)==null){
plugin.onlinePlayers.remove(data);
... | 8 |
protected ChunkManager(Plots p)
{
this.p = p;
chunkFile = new File(p.getDataFolder(), File.separator+"chunks.yml");
memberFile = new File(p.getDataFolder(), File.separator+"member.yml");
if(!chunkFile.exists())
{
try
{
if(!chunkFile.cre... | 6 |
static public String encode(final byte[] bytes) {
int i = 0, index = 0, digit = 0;
int currByte, nextByte;
StringBuffer base32 = new StringBuffer((bytes.length + 7) * 8 / 5);
while (i < bytes.length) {
currByte = (bytes[i] >= 0) ? bytes[i] : (bytes[i] + 256); // unsign
... | 6 |
public employee(String id) {
super(id);
} | 0 |
public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, ((Integer) value).intValue() + 1);
} else if (value instanceof Long) {
this.put(key, ((Long) value).longValue() + 1);
... | 5 |
public void title() {
switch(titleMenu.select()) {
case(-1):
break;
// Starting a new game
case(0):
if(Theater.saveFile.matches("New")) {
Theater.get().loadStage();
} else {
System.out.println("This shoudn't happen");
}
closeMenu();
titleMenu = null;
break;
// Loading a previous s... | 6 |
public boolean canHaveAsCreditLimit(BigInteger creditLimit) {
return (creditLimit != null) && (creditLimit.compareTo(BigInteger.ZERO) <= 0);
} | 1 |
public BulkAdd(java.awt.Frame parent, String currVersion, List<String> versions, String currCategory) {
super(parent);
initComponents();
files = new ArrayList<File>();
new FileDrop(jList1, new FileDrop.Listener() {
public void filesDropped(File[] f ) {
for(in... | 4 |
public static int floatAlphaToIntAlpha(float alpha) {
if(alpha < 0f || alpha > 1f) {
throw new IllegalArgumentException("alpha must be between 0f and 1f. value: " + alpha);
}
return (int) (255 * alpha);
} | 2 |
private void fileTransfertServer()
{
Socket l_newClient = null;
this.ctrl_fileServerActivation = true;
while( this.ctrl_fileServerActivation )
{
try
{
l_newClient = this.ctrl_srvSock.accept();
l_newClient.setSoTimeout( (int) this.ctrl_tcpTransfertTimeout );
ctrl_downloader.ReS... | 8 |
public boolean loadFixMessage( String aFixMessage )
{
logger.debug("Loading FIX string " + aFixMessage);
if ( ( getAtdl4jOptions().getInputAndFilterData() != null ) &&
( getAtdl4jOptions().getInputAndFilterData().getInputSelectStrategyName() != null ) )
{
logger.debug("getAtdl4jOptions().getInputAndF... | 7 |
@Test
public void testInstance() throws Exception {
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer ac = sp.parseSmiles("Nc1ccccc1");
IAtomContainer g1 = new AtomContainer(ac);
AdjacencyList adj = new AdjacencyList();
List<Node> no... | 9 |
public void checkForUpdate() throws IOException {
new Thread(new Runnable() {
@Override
public void run() {
try {
int retval = updater.DownloadUrlPool("Files/Version/Serverversion", "Serverversion", null);
if (retval == 1) {
... | 4 |
@Override
public V put(K key, V value) {
int code=key.hashCode();
int hash =hash(code);
hash &=mask;
int hash2 =hash2(code);
hash2 &=mask;
int hash3 =hash3(code);
hash3 &=mask;
Object tk =table[hash];
if (key.equals(tk)) {
V old =(V) table[hash + 1];
table[hash + 1] =value;
return old;
... | 7 |
public CLIController() {
Action exitAction = new Action() {
@Override
public void execute(ArgSet args) {
stopped = true;
}
};
Action debugAction = new Action() {
@Override
public void execute(ArgSet args) {
int i = args.fetchInteger();
Debugger.setLevel(i);
}
};
... | 8 |
public void renameAndHide() {
CPArtwork artwork = controller.getArtwork();
if (layerNb >= 0 && layerNb < artwork.getLayersNb()) {
artwork.setLayerName(layerNb, getText());
}
layerNb = -1;
setVisible(false);
setEnabled(false);
} | 2 |
public JSONObject putOpt(String key, Object value) throws JSONException {
if (key != null && value != null) {
this.put(key, value);
}
return this;
} | 2 |
public static int recuClimbStairs(int n){
if(n==1)
return 1;
if(n==2)
return 2;
int left = 0, right = 0;
if(tmpResult[n-1] == 0)
tmpResult[n-1] = recuClimbStairs(n-1);
left = tmpResult[n-1];
if(tmpResult[n-2] == 0)
tmpResult[n-2] = recuClimbStairs(n-2);
right = tmpResult[n-2];
return left + ... | 4 |
private double calculateScore(ArrayList<seed> seedlist) {
double total = 0.0;
for (int i = 0; i < seedlist.size(); i++) {
double score = 0.0;
double chance = 0.0;
double totaldis = 0.0;
double difdis = 0.0;
for (int j = 0; j < seedlist.size(); j++) {
if (j != i) {
totaldis = totaldis
... | 9 |
@Override
public void mouseDragged(MouseEvent e) {
Graphics graphics = d.getGraphics();
if(this.p.getCurrentTool() == -1){
if(working_layer != -1){
if(now_resizing){
p.resizeFigureUsingCorner(working_layer, active_corner, e.getX(), e.getY());
}else{
p.moveFiguresOnLayer(this.working_layer, e.g... | 4 |
public void update(double time) {
switch (enemyState) {
case MOVING:
updateMovement(time);
break;
case SHOOTING:
break;
case SEARCHING:
updateSearch(time);
break;
}
if (Collision.canEnemySeePlayer(this)) {
enterSightMode();
lastKnownPlayerLoc = Game.getWorld().getPlayer().location;
} ... | 6 |
public static boolean needsUpdate(EntityType type) {
boolean b = false;
switch (type) {
case OBJ_TREE:
break;
case OBJ_DOOR_WOOD:
break;
}
return b;
} | 2 |
public static void main(String[] args) throws IOException, NumberFormatException {
if (args.length < 1) {
System.out.println("Please use command \n"
+"java -jar yc173.jar \"tilepuzyc173\" \"tilepuzinput.txt\"\n"
+"or\n"
+"java -jar yc173.jar \"queensyc173\" n \n"
+"to run the jar file");
r... | 5 |
public static Punktbewegung findPunktbewegungById(ArrayList<Punktbewegung> punktbewegungs, int id) {
for(Punktbewegung punktbewegung:punktbewegungs) {
if(punktbewegung.getId()==id) {
return punktbewegung;
}
}
return new Punktbewegung();
} | 2 |
public void setData(String title, String yleg, final TimeSeriesCollection tsc) {
JFreeChart chart = ChartFactory.createTimeSeriesChart(
title, "Date", yleg, tsc, true, true, false);
XYPlot plot = (XYPlot) chart.getPlot();
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(){
private stat... | 8 |
@Test
public void testReadField_protected()
{
Assert.assertEquals(
"protected",
ReflectUtils.readField(new Bean(), "_field3")
);
} | 0 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.