text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void initiallizeWithHtmlTemplate(){
if (isFileEmprtyAtStart) {
String htmlTemplatePath =
"C:\\GitRepos\\JavaToSVG\\Templates\\html_template.html";
String line;
Path templatePath = Paths.get(htmlTemplatePath);
try(BufferedReader reader ... | 3 |
public PropertyTree(Property property,PropertyTree parent) {
this.property=property;
this.parent=parent;
this.children=null;
if(parent!=null)
parent.addChild(this);
} | 1 |
public static void main(String[] args) {
System.out.println("hello".substring(0,3));
int val = 268435456;
String inter = Integer.toBinaryString(val);
while(inter.length()<32)
{
inter = 0+inter;
}
String highest4bits = inter.substring(0, 4);
Str... | 3 |
static final void method3146(int i, int i_0_, byte i_1_, int i_2_,
int i_3_, int i_4_, byte[] is, byte[] is_5_,
int i_6_) {
try {
anInt9464++;
int i_7_ = -(i_0_ >> -394325566);
i_0_ = -(i_0_ & 0x3);
if (i_1_ >= -12)
method3148(true);
for (int i_8_ = -i_3_; i_8_ < 0; i_8_++) {
for... | 7 |
public ArrayList<ArrayList<String>> splitClauses(Sentence input) {
tokenizedSentence = input.getSentence();
charIdentifier = input.getPosTags();
int previousIndex = 0;
for (int index = 0; index < tokenizedSentence.size(); index++) {
if ((tokenizedSentence.get(index).matches... | 6 |
@Override
public void performInteraction(GameModel g, Unit myUnit) {
if (!myUnit.hasAttribute("Attack"))
return;
AttributeAttack att = (AttributeAttack) myUnit.getAttribute("Attack");
ArrayList<Tile> tileList = g.getMap().getTilesList();
for (Tile t : tileList) {
... | 7 |
public void AddTlv(int tag, String value) {
if (tag == TlvId.LinkID) {
this.LinkID = value;
} else if (tag == TlvId.Mserviceid) {
this.ProductID = value;
} else {
if (this.OtherTlvArray == null) {
Tlv[] tmp = new Tlv[1];
tmp[0] = new Tlv(tag, value);
this.OtherTlvArray = tmp;
} else {
... | 3 |
public add() {
this.info = "add a new venue";
this.addParamConstraint("name");
this.addParamConstraint("capacity", ParamCons.INTEGER);
this.addRtnCode(201, "already exists");
} | 0 |
@Override
public String getName() {
return NAME;
} | 0 |
public void setGameType(String game) {
GameType = game;
if (game.equals("matchcard")) {
if (matchestowin == 6) {
for (int i = 0; i < 6; i++) {
list4x3.add(i);
list4x3.add(i);
}
} else if (matchestowin == 10) ... | 6 |
private String getFloatValue(final Field field, final Object object) {
Object result = getRawValue(field, object);
if (result == null) {
result = "";
}
return result.toString();
} | 1 |
private static String getValue(String value)
{
return (value == null || value.trim().length() == 0) ? null : value.trim();
} | 2 |
* @return Kodierung des Konfigurationsverantwortlichen
*/
private short getAuthorityCoding(final ConfigurationConfigurationObject configurationObjectProperties) {
final ConfigurationObjectElements[] datasetAndObjectSet = configurationObjectProperties.getDatasetAndObjectSet();
for(ConfigurationObjectElements elem... | 7 |
public void setUp() throws Exception {
try {
d = new Database("dbauth.txt");
/*d = new Database("localhost", "postgres", "", "myapp_test"); //For travis-ci*/
try {
d.initTables();
}
catch(Exception e) {
d.cleanTables();
... | 2 |
@AnnotationTestTool
public void method2()
{
System.out.println("method1");
} | 0 |
public void steprun2() throws IOException
{
// FrontEnd.exceptionraised = 0;
// handlers.clean_branchtable();
// handlers.clean_memtable();
FrontEnd.activepane.getHighlighter().removeAllHighlights();
//FrontEnd.activepane.setSelectionColor(new Color(1.0f, 1.0f, 1.0f, 0.0f));
... | 7 |
public void setValuesWithMappingNameMap(final Map<String, Object> map,
final ValueVisitor defaultVisitor) {
Class<?> clazz = getClass();
final FieldDefinitionImpl thiz = this;
try {
SpringReflectionUtils.doWithFields(clazz,
new SpringReflectionUtils.FieldCallback() {
public void doWith(Field fie... | 7 |
public void onReceiveBid(MessageBid bid){
if (bid.getRound() == super.currentRound()) {
if (bestBid == null) {
bestBid = bid;
synchronized (syncIncr) {
shouldDecrease = true;
}
} else {
if (bestBid.getRound() < bid.getRound()) {
bestBid = bid;
synchronized (syncIncr) {
shoul... | 3 |
public ListNode deleteDuplicates(ListNode head) {
if(null == head || head.next == null) return head;
ListNode current = new ListNode(0);
current.next = head;
ListNode result = current;
ListNode normal = current.next;
ListNode compared = normal.next;
... | 5 |
private void initActions() {
for (int i = 0; i < tools.length; ++i) {
final Tool tool = tools[i];
String group = tool.group;
if (group.equals("tool")) {
tool.action = new Runnable() {
public void run() {
setPaintTool(tool.id);
}
};
} else if (group.equals("fill")) {
tool.action... | 9 |
public void warp(){
if(warped) return;
random = false;
destroyBodies();
scene = nextScene;
scene.create();
if(warp!=null){
Vector2 w = warp.getLink().getWarpLoc();
createPlayer(w);
if(warp.getLink().warpID==1 && !character.isFacingLeft()) character.setDirection(true);
if(warp.getLink().warpI... | 6 |
private boolean message_ready() {
// Message is completely read. Push it further and start reading
// new message. (in_progress is a 0-byte message after this point.)
if (msg_sink == null)
return false;
boolean rc = msg_sink.push_msg (in_progress);
... | 2 |
private void rotateUp(Node child) {
assert child != null &&
child.parent() != null &&
child.parent().parent() != null;
Node parent = child.parent();
Node grandparent = parent.parent();
if (grandparent.left() == parent) {
grandparent.setLeft(child);
} else {
g... | 4 |
public static void writeComment(
StringBuffer buf,
int depth,
String line_ending,
String comment
) {
indent(buf, depth);
buf.append("<!--");
buf.append(escapeXMLComment(comment));
buf.append("-->");
if (line_ending != null) {
buf.append(line_ending);
}
} | 1 |
private void doPaintBucketReg(int x, int y, Color newCol, Color currentCol)
{
// make sure it's on the image
if (x > -1 && y > -1 && x < this.getDrawingWidth()
&& y < this.getDrawingHeight()
&& this.getPointColor(x, y).equals(currentCol))
{
this.drawPoint(... | 7 |
public MainView(Shell shell) {
this.shell = shell;
addFileDropTarget(shell);
createMenubar(shell);
SashForm sash = new SashForm(shell, SWT.NONE);
this.fileList = new FileList(sash);
Composite right = new Composite(sash, SWT.NONE);
this.tabs = new CTabFolder(right, SWT.NONE);
GridLayout grid... | 7 |
TestState(final String description, final char state) {
this.description = description;
this.state = state;
} | 0 |
List<Score> matchCouple(List<Person> ps, List<Person> left){
left.clear();
System.out.println("matching");
Map<Person, List<Score>> table = calculateAffinity(ps);
//
List<Score> result = matchCoupleRound(table);
ps.stream()
.filter(p -> result.stream().noneMatch... | 1 |
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
if (isSelected && (-1 < index)) {
list.setToolTipText(((File) list.getModel().getElementAt(index)).getPath());
}
... | 2 |
private void nowaPaczka()
{
this.campaign.clearCampaign();
this.campaign.setGameDate(projectTabPane.getGameDate());
projectTabPane.initiateGameFields();
projectTabPane.updateGraph();
repaint();
} | 0 |
public int clearLines() {
int numClearedLines = 0;
for (int curOldLine = board.length-1 ; curOldLine >= 0; curOldLine--) {
if (curOldLine >= 2 && board[curOldLine] == 0x3ff)
numClearedLines++;
else
board[curOldLine + numClearedLines] = board[curOldLine];
}
for (int i = numCle... | 5 |
public boolean setUserlistImageWidth(int width) {
boolean ret = true;
if (width <= 0) {
this.userlistImg_Width = UISizeInits.USERLIST_IMAGE.getWidth();
ret = false;
} else {
this.userlistImg_Width = width;
}
somethingChanged();
retur... | 1 |
@Test
public void getIndexOutOfBoundsReturnsNull() {
a.insert(v);
assertEquals(null, a.get(Integer.MAX_VALUE));
assertEquals(null, a.get(-1));
} | 0 |
public static void main(String[] args) {
try {
String f1 = "/home/mayank/DistributedSystems/test1.txt";
File file1 = new File(f1);
FilePartition fp1 = new FilePartition(f1, 13, file1.length());
TextRecordReader reader = new TextRecordReader(fp1, null);
Record<String, String> record;
while( (r... | 5 |
public static synchronized User addUser(String username,
ArrayList<User> users) {
users = DataReader.getUsers();
// check if the user exists
for (User u : users) {
if (u.getUsername().equalsIgnoreCase(username)) {
System.out.println("User already exists");
return u;
}
}
// add the user to th... | 4 |
@EventHandler
public void onPlayerMove(PlayerMoveEvent e)
{
Zone zone = plugin.canPlayerWalkTo(e.getPlayer(), e.getTo());
if (zone != null)
{
if (!e.getPlayer().isDead())
e.getPlayer().sendMessage(zone.getOnEnter());
if (zone.isKillZone())
{
if (!e.getPlayer().isDead())
e.getPlayer().setHe... | 4 |
@Override
public String format(LogRecord record) {
String throwable = "";
if (record.getThrown() != null) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println();
record.getThrown().printStackTrace(pw);
pw... | 3 |
public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
... | 6 |
public void clean(double time) {
if (time <= 0 || jumpheight == 3) {
return;
}
this.setDirtiness(this.getDirtiness() - time/length);
} | 2 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String arg2,
String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (args.length < 1) {
player.sendMessage(ChatColor.YELLOW + "Deafened players:");
String plrs = "";
for (String p... | 9 |
public String [] toArray() {
return new String [] {String.valueOf(id), String.valueOf(defaultPoints), defaultTime.toString(), name};
} | 0 |
public static Move parseMove(String input) {
Move rez = new Move();
int index = 0;
while (index < input.length()) {
char type = input.charAt(index++);
switch (type) {
case 'a': rez.addAttack(getArea(input, index++)); break;
case 'b': rez.addBlock(getArea(input, index++)); break;
case '.':
... | 9 |
public double getWinningProbility(int c1,int c2){
if(!reduced){
if(!indexUpdated)updatePositionIndex();
return 1-position[c1*52+c2];
}else{
if(!rankUpdated)updateRank();
if(!positionUpdated)updatePosition();
int queryrank = 0;
if(common == 3){
queryrank = FiveEval.getBestRankOf(c1, c2,
... | 9 |
private byte[] CreateData()
{
//create byte buffer for data
byte[] buf = new byte[packetSize];
//holds the character bytes generated
StringBuilder s = new StringBuilder();
char c;
//generate data for the packet
for(int x=0; x< (packe... | 3 |
public String DELETE_Request(String url, String url_params) {
StringBuffer response;
String json_data = "";
HttpsURLConnection con = null;
try {
// url = "https://selfsolve.apple.com/wcResults.do";
// url_params = "sn=C02G8416DRJM&cn=&locale=&caller=&num=12345";
// URL obj = new URL(url);
// con = ... | 6 |
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKIData")
public JAXBElement<SPKIDataType> createSPKIData(SPKIDataType value) {
return new JAXBElement<SPKIDataType>(_SPKIData_QNAME, SPKIDataType.class, null, value);
} | 0 |
public CriterionGroup buildCriterionGroup() throws HqlBuildException {
if(this.form == null || this.ruleScheme == null){
return new CriterionGroup();
}
/**
* 1. 生成CriterionResult
*/
CriterionGroup group = new CriterionGroup();
/**
* 遍历Form对象所有属性
* 顺序是映射文件里面从上到下
*/
Iterator<String>... | 6 |
@Override
public void toggleEditability(int row, AttributeTableModel model) {
Node node = doc.tree.getEditingNode();
String key = (String) model.keys.get(row);
Object oldAndNewValue = node.getAttribute(key);
boolean oldReadOnly = node.isReadOnly(key);
boolean readOnly = !oldReadOnly;
node.setReadO... | 0 |
public static FileType getType(InputStream is) {
String fileHead = getFileHeader(is);
FileType[] fileTypes = FileType.values();
for (FileType fileType : fileTypes) {
if (fileHead.startsWith(fileType.getValue())) {
return fileType;
}
}
return FileType.NOTSUPPORTED;
} | 2 |
@Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
targetId = buf.readInt();
startCellId = buf.readShort();
if (startCellId < -1 || startCellId > 559)
throw new RuntimeException("Forbidden value on startCellId = " + startCellId + ", it doesn't respect... | 4 |
private void drawLabels(double current_time) {
// Draw take off button
int opacity = (airport.is_active || airport.aircraft_hangar.size() == 0) ? 128 : 256; // Grey out if not clickable
graphics.setColour(0, 128, 0, opacity);
double y = y_position +height -division_height;
if (!airport.is_active) {
graphic... | 5 |
private void TfCodProdutoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TfCodProdutoKeyReleased
if (!TfCodProduto.getText().equals("")) {
prodcompravenda.getForneproduto().getProduto().setCodigo(Integer.parseInt(TfCodProduto.getText()));
if (prodcompravenda.getForneproduto()... | 8 |
@Test
public void testTop() {
Random r = new Random(260379);
ArrayList<Integer> workArr = new ArrayList<Integer>();
TreeMap<Integer, Integer> countToId = new TreeMap<Integer, Integer>(new Comparator<Integer>() {
public int compare(Integer integer, Integer integer1) {
... | 4 |
private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 75
replab0: while (true) {
v_1 = cursor;
lab1: do {
// (, line 75
// [, line 77
bra = cursor;
// substring, line 77
among_var = find_among(a_1, 4);
if (among_var == 0) {
break lab1;
}
// ], line 77
... | 9 |
protected void configureCurrentConverter(int dialogType) {
String filename;
File currFile;
if ( (getSelectedFile() == null) || (getSelectedFile().isDirectory()) )
return;
filename = getSelectedFile().getAbsolutePath();
if (m_CurrentConverter == null) {
if (dialogType == LO... | 9 |
@Override
public String toString() {
StringBuilder sb = new StringBuilder("User(");
boolean first = true;
sb.append("firstName:");
if (this.firstName == null) {
sb.append("null");
} else {
sb.append(this.firstName);
}
first = false;
if (!first) sb.append(", ");
sb.appe... | 6 |
public BreakPoint commitMinPenalty(int space, int lastSpace,
int minPenalty) {
if (startPos == -1 || lastSpace > endPos - startPos
|| minPenalty == 10 * (endPos - startPos - lastSpace)) {
/* We don't have to break anything */
startPos = -1;
childBPs = null;
return this;
}
int size = c... | 9 |
public static void write (org.omg.CORBA.portable.OutputStream ostream, pgrid.service.corba.repair.RepairIssue[] value)
{
ostream.write_long (value.length);
for (int _i0 = 0;_i0 < value.length; ++_i0)
pgrid.service.corba.repair.RepairIssueHelper.write (ostream, value[_i0]);
} | 1 |
public String getContenido(File file) throws IOException {
String contenido = "";
if (file.exists()) {
try {
contenido = new Scanner(file).useDelimiter("\\Z").next();
} catch (FileNotFoundException ex) {
}
}
return contenido;
} | 2 |
public int ladderLength(String start, String end, Set<String> dict) {
if (dict.size() == 0)
return 0;
int curLevel = 1;
int nextLevel = 0;
int steps = 1;
boolean isEndReached = false;
Queue<String> bfsQueue = new LinkedList<String>();
Set<String> visited = new HashSet<String>();
bfsQueue.add(start);
... | 9 |
public void update(double diff) {
if (shootTimer <= diff) {
shoot();
shootTimer = 500;
} else shootTimer -= diff;
if (path.isEmpty()) {
int directionDiff = 300;
if (Game.bounds.contains(left ? me.getX() - directionDiff : me.getX() + directionDiff... | 7 |
public int getInt(String key) throws JSONException {
Object o = get(key);
return o instanceof Number ?
((Number)o).intValue() : (int)getDouble(key);
} | 1 |
public int getNodeID(int x, int y)
{
for(int i = 0; i < nodes.size(); i++)
{
if(x == nodes.get(i).getX() && y == nodes.get(i).getY()) return i;
}
return -1;
} | 3 |
public void propertyChange(PropertyChangeEvent e) {
if(e.getPropertyName().equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
File newFile =(File)e.getNewValue();
if (newFile != null){
if ((newFile.isFile()) && (FileDialogs.isImage(newFile))) {
Str... | 5 |
public static ItemStack setCustomBlockAmount(ItemStack item, int amount)
{
if ((amount <= 0) || (item == null) || (!item.hasItemMeta()))
return null;
ItemMeta meta = item.getItemMeta();
if ((meta == null) || (!meta.hasDisplayName()))
return item;
String title = meta.getDisplayName();
if ((title == null... | 7 |
public static void main( String[] args)
{
if(args == null || args.length == 0)
{
System.err.println(
"usage: java MappedPlaceholderResource <resourcefile basename> [[key] [value]] ...");
System.exit(1);
}
try
{
MappedPlaceholderResource mpr = new MappedPlaceholderResource(args[0]);
... | 9 |
@Test
public void itShouldSerializeMultiPoint() throws Exception
{
MultiPoint lineString = new LineString(new LngLatAlt(100, 0), new LngLatAlt(101, 1));
Assert.assertEquals("{\"coordinates\":[[100.0,0.0],[101.0,1.0]],\"type\":\"LineString\"}", mapper.toJson(lineString));
} | 0 |
private static void rsaEncrypterFile(CryptobyConsole console) {
// Input Path to File for encryption
scanner = new Scanner(System.in);
scanner.useDelimiter("\n");
System.out.println("Enter Path to File for Encryption (Type '" + quit + "' to Escape):");
if (scanner.hasNext(quit))... | 7 |
public List findRecords(String sqlString, boolean closeConnection)
throws SQLException, Exception
{
Statement stmt = null;
ResultSet rs = null;
ResultSetMetaData metaData = null;
final List list=new ArrayList();
Map record = null;
// do this in an excpetion handler so that we can depend on the
// fina... | 7 |
public static void main(String args[]) {
//MagicPower.setMP(999);
GraphicDisplay gd = new GraphicDisplay();
Game game = new Game(gd);
game.init();
gd.setGame(game);
gd.menu();
//gd.setup();
// game.getMap().addTower(2, 2);
// game.getMap().addTower(6, 1);
// game.getMap().addTower(8, 1);
// ... | 2 |
public void startTeleport2(int x, int y, int height) {
if(c.duelStatus == 5) {
c.sendMessage("You can't teleport during a duel!");
return;
}
if(c.duelStatus >= 1 && c.duelStatus <= 4) {
Client o = (Client) Server.playerHandler.players[c.duelingWith];
c.duelStatus = 0;
o.duelStatus = 0... | 6 |
public static Sha1Hash forValue (Value<?> value) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
// If the SHA1 algorithm doesn't exist, returns null
return null;
}
BencodeOutputS... | 3 |
public Car issueCar(DrivingLicense drivingLicense, String typeOfCar){
Date now = new Date();
Car c = AbstractCar.getInstance(typeOfCar, RegistrationNumber.getInstance(extracted(registrationNumber).getLetterIdentifier(), extracted(registrationNumber).getNumberIdentifier()), fuelCapacity, fuelInCar, carRented);
lo... | 8 |
private void readNormalPatchContent(SinglePatch patch) throws IOException, PatchException {
List<Hunk> hunks = new ArrayList<Hunk>();
Hunk hunk = null;
Matcher m;
for (;;) {
String line = readPatchLine();
if (line == null || line.startsWith("Index:")) {
... | 9 |
@Override
public Attributes clone() {
if (attributes == null)
return new Attributes();
Attributes clone;
try {
clone = (Attributes) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
clone.attr... | 3 |
public static void main(String[] args) {
Flower x = new Flower();
x.printPetalCount();
} | 0 |
public boolean readBuffersFromNextSoundInSequence()
{
if( !toStream )
{
errorMessage( "Method 'readBuffersFromNextSoundInSequence' may " +
"only be used for streaming sources." );
return false;
}
synchronized( soundSequenceLock )
... | 8 |
public boolean checkDraw() {
if (drawCounter == 42 &&
!(checkVertical()
&& checkMainDiagonal()
&& checkAntiDiagonal()
&& checkHorizontal())) {
game.setGameIsOver(true);
return true;
}
... | 5 |
public Vector getAcceleration(){
Vector accel = new Vector(0,-12);
if( isOnGround ){
accel.x = controller.getX()*3;
} else if ( controller.getButtonJump() && jetpackFuel > 0 ){
accel.x = controller.getX()*12;
} else {
accel.x = controller.getX()*1;
}
if( controller.getButtonJump() && jetpackFuel... | 5 |
public int getStudentCategoryId() {
return studentCategoryId;
} | 0 |
public String getDerivation() {
return derivation;
} | 0 |
void setElement(String name, int contentType, String contentModel,
Hashtable attributes) throws java.lang.Exception
{
Object element[];
// Try looking up the element
element = (Object[]) elementInfo.get(name);
// Make a new one if necessary.
if (element == null)... | 6 |
private void moveCamera(MouseEvent e) {
//System.out.println("============= Move camera ============");
try {
dragEndScreen = e.getPoint();
Point2D.Float dragStart = transformPoint(dragStartScreen);
Point2D.Float dragEnd = transformPoint(dragEndScreen);
do... | 1 |
public void run()
{
Socket sckOut = null;
InetSocketAddress isaTmp = null;
try
{
sckOut = new Socket();
sckOut.bind
(
new InetSocketAddress
(
EzimNetwork.localAddress
, 0
)
);
isaTmp = new InetSocketAddress
(
this.addr
, this.port
);
sckOut.connect(isaTmp,... | 4 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
HttpSession session=request.getSession(true);
Con... | 8 |
public EventInfo(String name, String loc, String id, String note) {
final JFrame eventInfo = new JFrame();
eventInfo.setVisible(true);
eventInfo.setTitle("Event Info");
eventInfo.setLocationRelativeTo(CalendarPanel.bullseye);
eventInfo.setSize(400, 300);
JPanel infoPanel = new JPanel();
eventInfo.getCon... | 7 |
private void maxHeapify(int pos){
if(!isLeaf(pos)){
if(myHeap[pos].compare(myHeap[this.leftChild(pos)]) == -1 || myHeap[pos].compare( myHeap[this.rightChild(pos)]) == -1){
if(myHeap[this.leftChild(pos)].compare(myHeap[this.rightChild(pos)]) == 1){
swap(pos, this.leftChild(pos));
maxHeapify(this.leftC... | 4 |
public void keyPressed(KeyEvent e)
{
if(count>=3 && count<5)
picnum=6;
if(count>4)
picnum=7;
if(count<3)
picnum=5;
int key = e.getKeyCode();
if(key == 37)
direction = LEFT;
else if(key == 38)
direction = UP;
else if(key == 39)
direction = RIGHT;
else if (key == 40)
directio... | 9 |
private static List<String> tokenise(String string, Map<Character, Match> matches, char escapeChar, boolean includeSplitCharAsToken) {
List<String> tokenised = new LinkedList<>();
StringBuffer sb = new StringBuffer();
boolean escape = false;
for (char c : string.toCharArray()) {
if (!escape && matches.conta... | 8 |
@Override
public void caseAParaPassoComando(AParaPassoComando node)
{
inAParaPassoComando(node);
if(node.getVar() != null)
{
node.getVar().apply(this);
}
if(node.getADe() != null)
{
node.getADe().apply(this);
}
if(node.getAP... | 5 |
@SuppressWarnings("unchecked")
@Override
public <T extends Serializable> DiagnosisChannel<T> channel(Class<? extends DiagnosisChannelID<T>> channel,
ChannelOption... options) {
// In case we are disabled, return a dummy
if (this.isD... | 7 |
private boolean isBlocked(float x, float y) {
boolean blocked = false;
float tweakedX = x + 4;
float tweakedY = y + 8 + mapY;
int rowCount = genX / blockSize;
int startY = (Math.round(mapY / blockSize))* rowCount + 1;
int endY = (Math.round((mapY + screenHei... | 7 |
public void run() {
while (true) {
try {
String msg = (String) sInput.readObject();
// if console mode print the message and add back the prompt
if (cg == null) {
System.out.println(msg);
System.out.print("> ");
} else {
cg.append(msg);
}
} catch (IOException e) {
... | 5 |
public void updateForecast() {
Date date = new Date();
long maxTimeNoUpdate = Long.parseLong(config.getWeather_expiration_time());
long timeNow = date.getTime()/1000L;
long timeLastForecast = 0;
try {
crs = qb.selectFrom("forecast").all().executeQuery();
if(crs.next()){
timeLastForecast = crs.getD... | 4 |
public HGSearchResult<T> execute()
{
switch (scanType)
{
case keys: return ((HGIndex<T, ?>)index).scanKeys();
case values: ((HGIndex<?, T>)index).scanValues();
default:
switch (operator)
{
case EQ:
return ((HGIndex<Object, T>)index).find(key.get());
... | 9 |
public void NextQuestion()
{
if(i == QuestionCount -1 )
{
i = 0;
}
else
{
// Current Question Id incremented by 1
i++;
}
// Display question in form
this.SetUp();
} | 1 |
private void trickleDown(int index) {
int largerChild;
BTPosition<T> top = heap.get(index);
while (index < size / 2) {
int leftChild = 2 * index + 1;
int rightChild = leftChild + 1;
if (rightChild < size
&& comp.compare(heap.get(leftChild).element(),
heap.get(rightChild).element()) < 0)
... | 4 |
@Override
public String getOutputStatement(String toDisplay) {
int l = toDisplay.length();
int dl = l * 2 + 11;
if (dl < 0)
dl = l;
StringBuilder sb = new StringBuilder(dl);
sb.append("println(\"");
for (int i = 0; i < l; i++) {
char c = toDisplay.charAt(i);
switch (c) {
case '\\':
sb.appen... | 8 |
public int minCut(String s) {
int min=0;
if(s==null||s.length()==0){
return min;
}
int len=s.length();
int[] cuts=new int[len+1];
boolean[][] matrix=new boolean[len][len];
//initiate the cuts to the worst condition
for(int i=0;i<len;i++){
cuts[i]=len-i;
... | 9 |
private static void loadOptions() {
File inputFile = new File("haven.conf");
if (!inputFile.exists()) {
return;
}
try {
options.load(new FileInputStream("haven.conf"));
} catch (IOException e) {
System.out.println(e);
}
String hideObjects = options.getProperty("hideObjects", "");
String hideHig... | 7 |
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.