text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean isDisturbed(Packet p) {
Position receiverPos = p.destination.getPosition();
double distanceFromSource = p.origin.getPosition().distanceTo(receiverPos);
double poweredDistanceFromSource = Math.pow(distanceFromSource, alpha);
double signal = p.intensity/poweredDistanceFromSource;
double noi... | 8 |
private String getExpressionType(Expr expr){
String type;
if (expr instanceof NumberExpr){
type = "Number";
}else if (expr instanceof LiteralExpr){
type = "String";
}else if (expr instanceof FunctionCallExpr){
String fktName = ((FunctionCallExpr) expr).getFunctionName();
if (fktName.equals("true()")... | 5 |
public int getLoopLength(BrainFuckCode code, boolean forvardSearch){
int loopLenght = 0;
int numberOfInnerLoops = 0;
int currentPosition = code.getCurrentPosition();
while (currentPosition > 0 && currentPosition < code.getCode().length()){
switch (code.getCode().charAt(curre... | 6 |
private void jTextField1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField1FocusLost
if(!nombreAntiguo.equals(jTextField1.getText())){
int i = JOptionPane.showConfirmDialog(frame, "Seguro que quieres cambiar la descripción de la política: "+nombreAntiguo+
"\npor "... | 8 |
@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 Township)) {
return false;
}
Township other = (Township) object;
if ((this.townshipID == null && other.township... | 5 |
public void calcRow(int step) {
int variableCount = Expression.getVariableCount();
String binaryStep = Integer.toBinaryString(step);
while (binaryStep.length() < variableCount) {
binaryStep = "0" + binaryStep; // " step 2 = '10' but if i have 3 steps i need '010'
}
List<String> steps = new ArrayList<>(Ex... | 5 |
public static void unpackConfig(Archive container) {
NpcDefinition.buffer = new Stream(container.get("npc.dat"));
Stream stream2 = new Stream(container.get("npc.idx"));
int totalNPCs = stream2.getUnsignedShort();
NpcDefinition.npcIndices = new int[totalNPCs];
int i = 2;
for (int j = 0; j < totalNPCs; j++) {... | 2 |
public void refreshTab(int index) {
if (index > -1) {
if (itemsPrice.size() > 0)
priceField.setText(formatter.format(itemsPrice.get(index)));
quantityTextField.setText("1");
if (itemsQuantity.size() > 0) {
availableQuantityField.setText(Integer.toString(itemsQuantity.get(index)));
grandTotalField... | 6 |
private boolean checkLapsedMillis() {
if (System.currentTimeMillis() - timer > 1000) {
return true;
} else {
return false;
}
} | 1 |
public ArrayList<ArrayList<Integer>> zigzagLevelOrder(TreeNode root) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
ArrayList<Integer> currentLevelValue = new ArrayList<Integer>();
Stack<TreeNode> currentLevelTree = new Stack<TreeNode>();
Stack<TreeNode> nextLevelTree = new Stack<... | 9 |
private void reload() throws IOException {
File f = new File("servers.json");
if(!f.exists()) {
writeServers();
System.out.println(Client.instance.translation.translate("file.created", "servers.json"));
}
servers = new Gson().fromJson(new InputStreamReader(new FileInputStream("servers.json"), Charset.forN... | 3 |
@Override
public void paintShape(mxGraphics2DCanvas canvas, String text,
mxCellState state, Map<String, Object> style)
{
Rectangle rect = state.getLabelBounds().getRectangle();
Graphics2D g = canvas.getGraphics();
if (labelGlyphs == null)
{
updateLabelBounds(text, style);
}
if (labelGlyphs != null... | 9 |
public boolean carOnLane(Car fCar, Lane lane)
{
PathIterator p = fCurve.getPathIterator(null);
FlatteningPathIterator f = new FlatteningPathIterator(p, reduceCarSpeed(fCar.getSpeed()));
while (!f.isDone())
{
float[] pts = new float[6];
switch (f.currentSegment(pts))
{
case PathIterator.SEG_MOVETO:... | 4 |
public static void main(String[] arguments)
{
//ファイルからテキスト群を読み込み
ArrayList<String> texts = ForestExample.loadFile();
//読み込んだテキストからブランチを生成
branches = ForestExample.loadBranch(texts);
//読み込んだテキストからノード生成
nodes = ForestExample.loadNode(texts,branches);
//ルートの設定
roots = ForestExample.loadRoot(nodes);
//ツリ... | 5 |
private void checkFullHouse() {
if (getNumberOfSuits(1) == 1 && getNumberOfSuits(2) == 1
&& getNumberOfSuits(3) == 1 && getNumberOfSuits(4) == 1) {
myEvaluation[0] = 7;
myEvaluation[1] = hand[0].getValue();
myEvaluation[2] = hand[4].getValue();
myEvaluation[3] = hand[0].getValue();
}
} | 4 |
public static ArrayList<Commands> Sort(ArrayList<Commands> list){
ArrayList<Commands> commands = new ArrayList<>();
for(Commands var1 : list){
if(var1.getCommand().equals("ADD")){
commands.add(var1);
}
}
for(Commands var2 : list... | 6 |
boolean isEmpty() {
return this.aNotification.size() <= 0;
} | 0 |
private void initGUI() {
try {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
getContentPane().setLayout(thisLayout);
this.setTitle("Tile Puzzle Solver");
pack();
this.setSize(894, 442);
this.setSize(Toolkit.getDef... | 6 |
private static void createTempJarInner(JarOutputStream out, File f,
String base) throws IOException {
if (f.isDirectory()) {
File[] fl = f.listFiles();
if (base.length() > 0) {
base = base + "/";
}
for (int i = 0; i < fl.length; i++) {
... | 5 |
public boolean isColliding(GameObject obj){
//If the left side of this is to the left right side of obj and the right side of this is to the right of the left side of obj
if(position.getComponent(0) < obj.position.getComponent(0) + obj.width && this.position.getComponent(0) + this.width > obj.position.getComponen... | 4 |
public static void main(String[] args) {
ThreadB threadB = new ThreadB();
for (int i = 0; i < 5; i++) {
new Thread(threadB, "线程名称:(" + i + ")").start();
}
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
... | 2 |
public Object getValueAt(int row, int column) {
TokenType type = editableStyles[row];
switch(column) {
case 0 :
String title = type.toString();
return title.charAt(0) + title.substring(1).toLowerCase();
case 1 :
return EditorStyle... | 5 |
@Override
public void operate(Player player, IncomingPacket packet) {
switch (packet.getOpcode()) {
/*
* Enlists a specified player as a friend.
*/
case 188:
long name = packet.getBuffer().getLong();
player.getPrivateMessaging().addFriendToList(name);
break;
/*
* Removes a specified player ... | 5 |
public static void addCard(Map<String, String> user) {
cards.put(user.get("userid"), new Card(gamePanel, user));
gamePanel.setSize(gamePanel.getSize());
} | 0 |
public static int findThreeSumClosest(int[] input, int target) {
// sort the array first
QuickSort.sort(input, 0 , input.length -1);
// set the min value
int minDiff = Integer.MAX_VALUE;
int result = 0;
// iterate from left to right
for( int i = 0; i< input.length... | 6 |
public Boolean isGameWon(){
for(int i=0;i<getX();i++){
for(int u=0;u<getY();u++){
if(this.cells[i][u]==2048){
return true;
}
}
}
return false;
} | 3 |
public int getAreaSize() {
int rval = 0;
if (type == TYPE_RECT) {
rval = rect.width * rect.height;
}
else if (type == TYPE_CIRCLE) {
rval = (int) ((double)circle_r * (double)circle_r * Math.PI);
}
else if (type == TYPE_POLY) {
rval = getPolygonArea(poly.xpoints, poly.ypoints, poly.npoints)... | 3 |
public MC_Location getLocationAtDirection(MC_DirectionNESWUD dir)
{
MC_Location loc = new MC_Location(this);
if(dir == MC_DirectionNESWUD.NORTH) loc.z--;
if(dir == MC_DirectionNESWUD.SOUTH) loc.z++;
if(dir == MC_DirectionNESWUD.WEST) loc.x--;
if(dir == MC_DirectionNESWUD.EAST) loc.x++;
if(dir... | 6 |
public void testIllegalCharacters()
{
System.out.println("\nStarting testIllegalCharacters: users");
try
{
new User("RegularName");
}
catch (IllegalArgumentException iae)
{
fail("iae not expected.");
}
try
{
new User("NumbersWithinName3350");
}
catch (IllegalArgumentException iae)
... | 6 |
private ByteBuffer connectClient(String username, String address) {
ClientConnectionLogRecord record = new ClientConnectionLogRecord(
address, SystemEvent.CLIENT_CONNECTION,
"Received connection request from " + address + " for client "
+ username + ".");
LOGGER.log(record);
Connection conn = null;... | 7 |
public JTextField getjTextFieldAdresse() {
return jTextFieldAdresse;
} | 0 |
private ArrayList<Chord> trackAnalyze(Track track){
ArrayList<Chord> result = new ArrayList<Chord>();
long tick = -1;
int t = 0;
while(t<track.size()-1){
try{
ShortMessage tmp = (ShortMessage) track.get(t).getMessage();
long newTick = track.get(t).getTick();
if (tmp.getCommand()>=144 && tmp.g... | 9 |
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String Name = request.getParameter("Name");
String City = request.getParameter("City");
String Address = request... | 5 |
private void btnSaveProfilesMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSaveProfilesMousePressed
HashMap<String, Profile> profiles = manager.getProfiles();
for (String username : profiles.keySet()) {
try {
profiles.get(username).save();
} catch (IOException e) {
... | 2 |
public String getMessage() {
return "Congrats!";
} | 0 |
public static boolean isBombed(int x, int y, int[][] sea)
{
return (isHit(x, y, sea) || isMiss(x, y, sea));
} | 1 |
public static Long makeLong( String s) throws Exception
{
long val =0;
if( s.length() > 32)
throw new Exception("Can't encode");
for(int x=0; x < s.length(); x++)
{
char c = s.charAt(x);
if( c== 'A')
{
val =val | ( A_INT << (x*2));
}
else if ( c== 'C')
{
val = val | (C_... | 6 |
public static byte[] bytesFromValue(final Value value) throws UnsupportedEncodingException {
byte[] bytes;
switch (value.getType()) {
case NIL:
bytes = new byte[]{NIL};
break;
case BOOLEAN:
if (value.getBooleanValue()) {
... | 7 |
private float normalize(float x) {
if (x > 315) return 0;
if (x > 225) return 270;
if (x > 135) return 180;
if (x > 45) return 90;
if (x > -45) return 0;
if (x > -135) return -90;
if (x > -225) return -180;
if (x > 315) return -270;
return -360;
} | 8 |
public int[][] labeling(BufferedImage image){
int label = 0;
int width = image.getWidth();
int height = image.getHeight();
labeledImage = new int[height][width];
//start labeling
for(int h = 1 ; h < height-1; h++){
for(int w = 1 ; w < width-1; w++){
int pixel = im... | 7 |
private void completeNickname(KeyEvent e) {
e.consume();
String text = getText();
if ( text.trim().isEmpty() )
return;
AbstractTab activeTab = InputHandler.getActiveTab();
if (activeTab instanceof ChannelTab == false)
return;
ChannelTab tab = (C... | 7 |
@Override
public Object getValueAt(int row, int col) {
switch (col) {
case 0:
return this.arrayListSong.get(row).getTitle();
case 1:
return this.arrayListSong.get(row).getArtist();
case 2:
ret... | 8 |
public Command getCommand(String key) {
return (Command) commands.get(key);
} | 0 |
private void broadenRiver(Tile tile, int broad, int rivnum) {
Point[] surrPoints = Utils.getSurroundingPoints(tile.origin);
for (Point p : surrPoints) {
Tile t = MyzoGEN.getOutput().getTile(p);
if (t != null && t.riverID == -1 && t.floor == tile.floor) {
t.tile = Tiles.WATER;
t.river = true;
t.riv... | 9 |
@Override
public void run() {
while (Fenetre._state != StateFen.Level) {
// Verifie l'etat du menu toute les demi-seconde
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} | 2 |
final private boolean jj_3R_199() {
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(113)) {
jj_scanpos = xsp;
if (jj_scan_token(114)) {
jj_scanpos = xsp;
if (jj_scan_token(115)) {
jj_scanpos = xsp;
if (jj_scan_token(116)) {
jj_scanpos = xsp;
if (jj_scan_token(117)) {
jj_sc... | 7 |
private static void writeResampledFile(OtuWrapper wrapper,
List<Integer> resampledList, boolean discrete, boolean allSameDepth,
int maxIndex, int maxDepth) throws Exception
{
File outFile =
new File(
ConfigReader.getBigDataScalingFactorsDir()
+ File.separator + "risk" +
File.separat... | 7 |
public BroadcastMessageParser(byte[] data){
super(data);
this.nickLength = data[510];
this.hostLength = data[511];
byte[] tempNickAsBytes = new byte[255];
byte[] tempHostAsBytes = new byte[255];
System.arraycopy(data, 0, tempNickAsBytes, 0, this.nickLength);
System.arraycopy(data, 255, tempH... | 4 |
public static Cons allEquivalentCollections(LogicObject self, boolean reflexiveP) {
{ Cons equivalents = Cons.consList(Cons.cons(self, Stella.NIL));
List unscannedequivalents = List.list(Cons.cons(self, Stella.NIL));
LogicObject u = null;
if (LogicObject.allSupercollections(self).memberP(self)) {... | 7 |
public void sendAttackResult(boolean result) {
if (gui != null) {
gui.updateState(eBattleFieldMode.Displaying);
}
Message<Boolean> attackResult = new Message<>();
attackResult.setMessageType(eMessageType.attackResult);
attackResult.setDataContainer(result);
op... | 1 |
* @return Returns true if the the connection between the given terminals
* is valid.
*/
public boolean isValidConnection(Object source, Object target)
{
return isValidSource(source) && isValidTarget(target)
&& (isAllowLoops() || source != target);
} | 3 |
byte[] expandChunkData(byte[] input, int inputLength, byte[] buffer, PassthroughConnection ptc) {
if(buffer.length < inputDataBufferSize + outputDataBufferSize + expandedBufferSize + 320 || inputLength > inputDataBufferSize) {
return null;
}
ptc.inflate.reset();
ptc.inflate.setInput(input, 0, inputLength);... | 5 |
@Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if(((msg.sourceMinor()==CMMsg.TYP_QUIT)
||(msg.sourceMinor()==CMMsg.TYP_SHUTDOWN)
||((msg.targetMinor()==CMMsg.TYP_EXPIRE)&&(msg.target()==oldRoom))
||(msg.sourceMinor()==CMMsg.TYP_ROOMRESET))
&&(msg.source().location()!=null)
&&(msg.s... | 9 |
public static void sellItemTester(String name){
if(ItemStorageInventory.create().sellItemfromStorage(name)){
System.out.println("Sell "+ name + " successfully\n");
}else
System.out.println("sell "+name+" failed\n");
} | 1 |
@Override
public void restoreTemporaryToCurrent(){tmp = new Color(cur.getRGB());} | 0 |
private void getdefaults() {
config.options().copyDefaults(true);
} | 0 |
private static void getLocations(){
BufferedReader buffer = null;
int id = 0;
Region region = null;
try{
String sCurrentLine;
try{
buffer = new BufferedReader (new FileReader("src/Model/Locations.txt"));
}catch(FileNotFoundException exc){
exc.printStackTrace();
}
while((sCurrentLine = buf... | 7 |
public HTTPResponse generateResponse( )
{
try {
final DocumentController controller =
ControllerFactory.getController(
request.getResource().substring(1)
);
switch (request.getMethod()) {
case GET:
... | 7 |
public static boolean sessionDelete(String sessionID, int versionNum, Server server) {
try {
DatagramSocket RPCSocket = new DatagramSocket();
RPCSocket.setSoTimeout(1000);
String callID = UUID.randomUUID().toString(); // A unique id for this call
String tempSend = callID + "^" + SESSIONDELETE_CODE... | 4 |
private synchronized void recenterMouse() {
if (robot != null && comp.isShowing()) {
centerLocation.x = comp.getWidth() / 2;
centerLocation.y = comp.getHeight() / 2;
SwingUtilities.convertPointToScreen(centerLocation,
comp);
isRecentering = true;
... | 2 |
@Override
public PaintResource get(Widget widget) {
final boolean temp = (highlight && widget.isHovered());
return new PaintResource(new GradientPaint(widget.getX(), widget.getY(), (temp) ? primary.brighter() : primary, widget.getX() + ((direction & HORIZONTAL) == HORIZONTAL ? widget.getWidth() : 0)... | 5 |
public int maxProfit(int[] prices) {
int max = 0;
for(int i =0;i< prices.length-1;i++){
if(prices[i+1]> prices[i])
max += prices[i+1]- prices[i];
}
return max;
} | 2 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
private void generarOperacionAleatoria(int a, int b, int c)
{
//En caso de que sea una division y el divisor sea 0, se le asigna un nuevo valor al divisor sin considerar el cero.
if (b == 0 && c == 4) {
b = Aleatorio(1, 10);
}
switch (c)
{
case 1: ... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
// Apparently this is bad style, but we need interfaces and classes with
// the same name and package to be equal
if (getClass().getSuperclass() != obj.getClass().getSuperclass())
return false;... | 9 |
public static boolean isStringPalindrome(String str){
List<Character> chars = new LinkedList<>();
for (Character item : str.toCharArray()){
chars.add(item);
}
ListIterator<Character> str1 = chars.listIterator();
ListIterator<Character> str2 = chars.listIterator(chars... | 4 |
int editDistance(String s1, String s2){
if(s1==null && s2==null)
return 0;
else if(s1==null)
return s2.length();
else if(s2==null)
return s1.length();
else {
int l1 = s1.length();
int l2 = s2.length();
int[][] dp = n... | 9 |
public static final ArrayList<SimpleEntry<String, String>> readFile(String filename) {
ArrayList<SimpleEntry<String, String>> stringList = new ArrayList<SimpleEntry<String, String>>();
try {
FileInputStream input = new FileInputStream(filename);
BufferedReader reader = new BufferedReader(new InputStreamReader... | 6 |
private boolean nonZero(Object obj){
if(obj==null)
return false;
if(obj instanceof Boolean){
return ((Boolean)obj).booleanValue();
}
if(obj instanceof Float || obj instanceof Double){
return ((Number)obj).doubleValue()!=0.0;
}
if(obj instanceof Number){
return ((Number)obj).longValue()!=0;
}
... | 6 |
protected static Ptg calcSmall( Ptg[] operands ) throws CalculationException
{
if( operands.length != 2 )
{
return new PtgErr( PtgErr.ERROR_VALUE );
}
Ptg rng = operands[0];
Ptg[] array = PtgCalculator.getAllComponents( rng );
if( array.length == 0 )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
i... | 7 |
public void update(float dt){
if(moving){
if(path!=null)
goalPosition = path.getCurrent();
if(goalPosition!=null) {
//offset Tile image according to speed?
tile.setOffsetX(tile.getOffsetX() + dt);
//finished moving?
if(true){
if(path!=null){
path.stepIndex();
if(pat... | 6 |
public int Expect(String Data, int NumBytes )
{
byte target = 0;
int cnt = 0;
try
{
while ((NumBytes--) != 0)
{
target = file.readByte();
if (target != Data.charAt(cnt++)) return DDC_FILE_ERROR;
}
} catch (IOException ioe)
{
return DDC_FILE_ERRO... | 3 |
public static ArrayList<Integer> slidingMaximumDqueue(final List<Integer> a, int b) {
ArrayList<Integer> result = new ArrayList<Integer>();
Deque<Integer> deque = new ArrayDeque<>();
for (int i = 0; i < b; i++) {
while (!deque.isEmpty() && a.get(deque.getLast()) <= a.get(i)) {
... | 9 |
private void RemovePlayer(Player player) {
if (_fightingPlayers.contains(player)) {
_fightingPlayers.remove(player);
String message = String.format("Tribute '%s' has been killed",
player.getName());
ChatManager.sendMessageToServer("GameMaker", message);
}
if (_playerSpawns.containsValue(player)) {
... | 5 |
public void create(User user) throws RollbackFailureException, Exception {
if (user.getArticleList() == null) {
user.setArticleList(new ArrayList<Article>());
}
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
List<Artic... | 7 |
public void saveIntoXMLFile( String filename ) {
try {
// set up xml doc factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder db = factory.newDocumentBuilder();
Document xmlDoc = db.newDocument();
// set up xml builder
TransformerFactory tf = TransformerFac... | 9 |
private void genPositionBloc( int nbPositionBloc )
{
PositionBloc position = null;
PositionBloc positionNouvelle = null;
int numeroVoie = 0;
// création manuelle du premier bloc de la voie.
if( this.sens == 1 )
{
position =... | 5 |
public void kertausmaatti(){
File kertaustiedosto = kertauspaneeli.hankiTiedosto("Valitse tiedosto");
if (kertaustiedosto != null){
kertausmaatti.setTiedosto(kertaustiedosto);
kertausmaatti.haeTunnisteet();
kertauspaneeli.luoTunnisteidenValinta();
CardLayo... | 1 |
public void printToFile(String filePath) {
try {
StringBuilder sbOutput = new StringBuilder();
// Output each member of settings.
for (Field field : this.getClass().getDeclaredFields()) {
String typestr = field.getType().toString().toLowerCase();
if (typestr.endsWith("string") || typestr.endsWith("in... | 7 |
public void writeCode(Code code) throws IOException {
// call putBit() on all bits, from left to right
for (int i = code.length() - 1; i >= 0; i--) {
putBit(code.getBit(i));
}
} | 1 |
public Pair<Symbol, SymbolString> getAmbiguousCore() {
AmbNode amb = getMinimalParseTree();
if (amb == null) {
String s = "No ambiguity node found for " + top.getRootSymbol() + " : " + top.yield().prettyPrint();
System.out.println(s);
//throw new RuntimeException(s);
return new Pair<Symbol, SymbolStr... | 9 |
public void followPlayer(Rachel r){
if(seePlayer(r)){
follow++;
}
if(follow > 0){
if(r.getY() > getY()){
setDown(true);
} else {
setDown(false);
}
if(r.getY() < getY()){
setUp(true);
} else {
setUp(false);
}
if(r.getX() < getX()){
setLeft(true);
} else {
se... | 6 |
public void maintainDealer() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InterruptedException{
while(true){
Thread.sleep(1);//So that commands don't happen at the same exact time.
if(!callsToDealer.isEmpty()){
final ArrayList<... | 8 |
public void execute() {
this.from.removePiece(this.piece);
this.to.addPiece(this.piece);
this.piece.increaseMoveCount();
} | 0 |
public static String removeAccelerator(String text)
{
String modifiedText = text;
// Search for ~
int location = text.lastIndexOf(CONTROL_2);
// If not found then search for hex EE
if (location < 0)
{
location = text.lastIndexOf(CONTROL_1);
}
// If not found then search for '&'
if (location < 0... | 3 |
public static boolean readBoolean()
{
String token = getNextToken();
boolean bool;
try
{
if (token.toLowerCase().equals("true"))
bool = true;
else if (token.toLowerCase().equals("false"))
bool = false;
else
{
error ("... | 3 |
public static void reset_branch(String num, String filepath, String downloadpath, Scanner scanner){
String line="", result = "";
int item=0;
System.out.println("Please choose the reset button's status that you want to test: 1=press, 2=release, 0=return:");
System.out.println("If you choose to test the pressed s... | 7 |
@GET
@Path("events/{id}/cars")
@Produces({MediaType.APPLICATION_JSON })
public List<Car> getEventCars(@PathParam("id")int idEvent){
System.out.println("Return the cars list of the event selected by the id");
return JpaTest.eventService.getCars(idEvent);
} | 0 |
static final int Mix3To1(final int c1, final int c2) {
//return (c1*3+c2) >> 2;
if (c1 == c2) {
return c1;
}
return ((((c1 & Mask2) * 3 + (c2 & Mask2)) >> 2) & Mask2) |
((((c1 & Mask13) * 3 + (c2 & Mask13)) >> 2) & Mask13) |
((((c1 & Mask4) >> 2) * 3 + ((c2 & Mask4) >> 2)) & Mask4);
} | 1 |
public String getAcademicLevel() {
return AcademicLevel;
} | 0 |
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] split) {
boolean r = false;
if (sender instanceof Player) {
Player player = (Player) sender;
if (instance.pex.has(player, "bitreport.report")) {
if (split.length > 0) {
String data = "";
for (in... | 9 |
private boolean isFalseCharacter(char c) {
if (c == '(' || c == ')' || c == '1' || c == '0' || c == ' ')
return false;
for (int i = 0; i < operator.length; i++) {
if (c == operator[i])
return false;
}
return true;
} | 7 |
public static boolean ProcessorUpdateList()
{
File list = FileManager.modList;
installedMods = FileManager.installedMods;
installedCoreMods = FileManager.installedCoreMods;
if (list != null && list.exists())
{
try
{
List<String> mods =... | 7 |
private void initComponents() {
selectSectionLbl = new JLabel();
selectSectionScrollPanel = new JScrollPane();
selectSectionJTable = new JTable();
selectDirectionLbl = new JLabel();
motherLangTransRadioBtn = new JRadioButton();
transMotherLangRadioButton = new JRadioButt... | 3 |
public boolean win(Value sign) {
Boolean win = false;
if (sign != Value.empty) {
for (int pointer = 0; pointer < EngineField.sizeField; pointer++) {
if (checkColumn(pointer, sign)) win = checkColumn(pointer, sign);
if (checkLine(pointer, sign)) win = checkLine... | 6 |
protected int parseInt(String input) {
int i;
if (input == null) {
i = FAILURE;
} else {
try {
i = Integer.parseInt(input);
} catch (NumberFormatException e) {
i = FAILURE;
}
}
return i;
} | 2 |
public static String quote(String str) {
return (str != null ? "'" + str + "'" : null);
} | 1 |
public void start(final Stage primaryStage) {
try {
Context.get().setSingleton(Stage.class, primaryStage);
Context.get().setSingleton(Application.class, this);
this.application = loadApplicationLoader();
Context.get().setSingleton(ApplicationLoader.class,
this.application);
this.application.init(p... | 7 |
public static void main(String[] args){
HashMap<String, Command> cmds = new HashMap<String, Command>();
cmds.put("ADD", new Add());
cmds.put("DEF", new Define());
cmds.put("DIV", new Div());
cmds.put("MUL", new Mul());
cmds.put("POP", new Pop());
cmds.put("PRN", n... | 6 |
private void initialise() throws IOException {
// Reads the state of the ContactManager from a CSV File.
BufferedReader CSVFile = new BufferedReader(new FileReader(fileName));
String dataRow = CSVFile.readLine();
// System.out.println(dataRow);
// Reads each line... | 6 |
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.