text stringlengths 14 410k | label int32 0 9 |
|---|---|
List<Compound> list() {
if (p == null) {
p = new ArrayList<Compound>();
for (T el : list) {
p.add(create(el));
}
}
return p;
} | 2 |
public String diff_prettyHtml(LinkedList<Diff> diffs) {
StringBuilder html = new StringBuilder();
for (Diff aDiff : diffs) {
String text = aDiff.text.replace("&", "&").replace("<", "<")
.replace(">", ">").replace("\n", "¶<br>");
switch (aDiff.operation) {
case INSERT:
... | 4 |
@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 Tache)) {
return false;
}
Tache other = (Tache) object;
if ((this.num == null && other.num != null) || (this.nu... | 5 |
public boolean httpPostWithFile(String url, String queryString,
List<QParameter> files, QAsyncHandler callback, Object cookie) {
if (url == null || url.equals("")) {
return false;
}
url += '?' + queryString;
PostMethod httpPost = new PostMethod(url);
List<QParameter> listParams = QHttpUtil.getQueryParam... | 6 |
@Override
public Polynomial<Double, Double, Double> setCoefficient(final int degree,
final Double value) {
if (degree < 0)
throw new IllegalArgumentException("The specified degree must be " +
"non-negative.");
if (this.getDegree() < degree)
thr... | 5 |
private static void sortStudents(ArrayList<Student> studentArray2) {
//Student top = studentArray2.get(0);
int j, first;
for(int i=studentArray2.size() - 1; i > 0; i--)
{
first = 0;
for(j = 1; j <= i; j++)
{
if((studentArray2.get(j).getLength()) < (studentArray2.get(fir... | 4 |
public void treeNodesInserted(TreeModelEvent e) {
TreePath path = e.getTreePath();
Object root = tree.getModel().getRoot();
TreePath pathToRoot = new TreePath(root);
if (path != null && path.getParentPath() != null
&& path.getParentPath().getLastPathCo... | 4 |
private String sendDataOut(String key, String data) throws TimeoutException {
ClientInfo ci = new ClientInfo();
ci.setClientKey(key);
PooledBlockingClient pbc = null;
try {
pbc = blockingClientPool.getBlockingClient(ci);
if (pbc == null) {
throw new TimeoutException("sdo: we do not have any client[p... | 5 |
private void jj_save(int index, int xla) {
JJCalls p = jj_2_rtns[index];
while (p.gen > jj_gen) {
if (p.next == null) { p = p.next = new JJCalls(); break; }
p = p.next;
}
p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
} | 2 |
static void rotate(int[][] matrix) {
int n = matrix.length;
int tmp;
for (int offset = 0; offset < n/2; offset++) {
for (int i = offset; i<offset+n-2*offset-1; i++) {
tmp = matrix[offset][i];
matrix[offset][i] = matrix[n-1-i][offset];
m... | 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 Dokument)) {
return false;
}
Dokument other = (Dokument) object;
if ((this.dokumentid == null && other.dokument... | 5 |
@Override
public int compareTo(Version o)
{
if (o == null)
{
throw new NullPointerException();
}
if (super.compareTo(o) != 0)
{
return super.compareTo(o);
}
if (!(o instanceof BigVersion))
{
// ... | 7 |
public void suspend() throws InterruptedException {
suspending = true;
while(suspending)
{
Thread.sleep(10);
}
} | 1 |
public void alterar(Paciente pacienteAnt) throws Exception {
if(pacienteAnt.getNome().isEmpty()){
throw new Exception("Nome esta invalido !!");
}else{
this.verificaNome(pacienteAnt.getNome());
}
if(pacienteAnt.getCpf().equals(" . . - ")){
throw ... | 4 |
private static void showAllRoles() throws Exception {
RoleDAO dao = new RoleDAO();
ArrayList users = (ArrayList) dao.findAll();
Role o;
System.out.println("Listing roles...");
for (int i = 0; i < users.size(); i++) {
o = (Role) users.get(i);
... | 1 |
public static byte linear2alaw(short pcm_val)
/* 2's complement (16-bit range) */
{
byte mask;
byte seg=8;
byte aval;
if (pcm_val >= 0) {
mask = (byte) 0xD5; /* sign (7th) bit = 1 */
} else {
mask = 0x55; /* sign bit = 0 */
pcm_val = (short) (-pcm_val - 8);
}
... | 5 |
public boolean isKeysOpen() {
HUD hud = null;
for (int i = (huds.size() - 1); i >= 0; i--) {
hud = huds.get(i);
if (hud.getName().equals("ScreenKeys")) {
return hud.getShouldRender();
}
}
return false;
} | 2 |
void handleLeaderDisconnection() {
String [] disMessagePieces= backupAccumulatorString.split(DELIM, 3);
//wait until new backupString is updated since it might take time
while (disMessagePieces.length < 2)
disMessagePieces= backupAccumulatorString.split(DELIM, 3);
currentLeaderInfo = disMessagePi... | 8 |
@Test
public void testCreateQueueSender() {
QueueSender pub;
try {
pub = BrokerFactoryImpl.createSender("TestQueue");
assertNotNull("TopicPublisher is null", pub);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokerError e) {
fail("Unexpected exception while creating publisher")... | 3 |
@Override
public String getColumnName(int c) {
String result;
switch (c) {
case 0:
result = "Name";
break;
case 1:
result = "Registration date";
break;
case 2:
result = "Last log-in da... | 4 |
@Override
public void onUpdate(World apples) {
if (!apples.inBounds(X, Y))
{
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
if (!apples.isSolid(X, Y-10))
{
Y-=10;
}
for (int i = 1; i < 10; i++)
{
if (!apples.is... | 7 |
private int finishReservations() {
int resFinished = 0;
Iterator<ServerReservation> iterRes = reservTable.values().iterator();
while(iterRes.hasNext()) {
ServerReservation sRes = iterRes.next();
if(sRes.getActualFinishTime() <= GridSim.clock()) {
sRes.setStatus(ReservationStatus.... | 3 |
private void parseLine(ContainerSqlFragment container, Line line) {
String trimmed = line.lineTrimmed();
if (trimmed.length() == 0) {
return;
}
if (trimmed.contains("@INCLUDE")) {
parseIncludeTag(container, line);
} else if (trimmed.contains("@LIKE")) {
parseOperatorTag(con... | 9 |
@Test
public void testGetPositions()
{
RosterDefinition roster = new RosterDefinition();
Set<FantasyPosition> fantasyPositions = roster.getFantasyPositions();
Assert.assertNotNull("Failed to retrieve fantasy position set",
fantasyPositions);
Assert.as... | 7 |
public void savePattern(Pattern pattern, String fn) {
try {
fn = "recordings/" + fn;
FileWriter fw = new FileWriter(new File(fn));
System.out.println("Saving pattern");
fw.write(pattern.rightHanded + "\n");
//for each frame in the pattern
for (int i=0; i<pattern.length; i++) {
if (i > 20)
... | 5 |
public double score(StringWrapper s,StringWrapper t)
{
BagOfTokens sBag = asBagOfTokens(s);
BagOfTokens tBag = asBagOfTokens(t);
double lambda = 0.5;
int iterations = 0;
while (true) {
double newLamba = 0.0;
// E step: compute prob each token is draw from T
for (Iterator i = sBag.tokenIterator(); i... | 5 |
public PlayerClass(String configPath) {
effects = new ArrayList<PotionEffect>();
items = new ArrayList<ItemStack>();
armor = new ArrayList<ItemStack>();
if (config.contains(configPath + ".Items")) {
List<Integer> itemIds = config.getIntegerList(configPath + ".Items");
for (int id : itemIds) items.add(new ... | 9 |
private void setStackNumElem(StackNum stackNum, Object...obj){
for(Object o : obj){
stackNum.add(o);
}
} | 1 |
public <C extends StatefulContext> void callOnStateLeaved(StateEnum state, C context) throws Exception {
Handler h = handlers.get(new HandlerType(EventType.STATE_LEAVE, null, state));
if (h != null) {
ContextHandler<C> contextHandler = (ContextHandler<C>) h;
contextHandler.call(c... | 2 |
protected synchronized final void addTComponent(TComponent component)
{
if (component != null && !getTComponents().contains(component))
{
/*
* Only initiates the TComponent if it has not been
* initiated already and this class has had it's own
* parent set.
*/
if (com... | 9 |
public void stats() {
// Sort by start
markers.sort(false, false);
Marker prev = null;
for( Marker m : markers ) {
lengthStats.sample(m.size());
// Distance to previous interval
if( (prev != null) //
&& (m.getChromosome().getId().equals(prev.getChromosome().getId())) // Same chromosome?
) {
... | 4 |
public static void closeSession() throws HibernateException {
if (session != null)
session.close();
session = null;
} | 1 |
public String deleteSpaces(String ligne){
int i;
StringBuilder sb = new StringBuilder();
for(i=0;i<ligne.length();i++){
if(ligne.charAt(i) == ' '){
if(i!=0)
sb.append(ligne.charAt(i));
while(i+1<ligne.length() && ligne.charAt(i+1) == ' ')
i++;
}
else
sb.append(ligne.charAt(i))... | 5 |
public void open() {
Display display = Display.getDefault();
createContents();
shlPscDatabase.open();
shlPscDatabase.layout();
while (!shlPscDatabase.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} | 2 |
public CastlingMove(Player player, Board board, Piece piece, Field from, Field to) {
super(player, board, piece, from, to);
} | 0 |
private boolean validPosition(int[][] temp,int x, int y) {
return !(x < 0 || y < 0 || x >= temp.length || y >= temp[0].length);
} | 3 |
private void addMethod(Method method) {
Deploy deploy = (Deploy) method.getAnnotation(Deploy.class);
if (deploy != null) {
for (String path : deploy.value()) {
addMethodPath(path, method);
}
}
} | 2 |
public List<RanglistenEintrag> getTeamRangliste() {
List<Team> alleTeams = eloPersistence.createQuery("select distinct t from Team t join fetch t.punktzahlHistorie", Team.class)
.getResultList();
Collections.sort(alleTeams, new Comparator<Team>() {
public int compare(Team o1, Team o2) {
return (o1.getPun... | 6 |
public GenericNode getOther(GenericNode node) {
if(node1 == node) return node2;
if(node2 == node) return node1;
return null;
} | 2 |
static final void method2060(byte i, boolean bool) {
if (i > -4)
method2059(-6);
anInt3484++;
Class5_Sub3.anInt8374++;
BufferedPacket class348_sub47
= Class286_Sub3.createBufferedPacket(Class348_Sub34.aClass351_6970,
Class348_Sub23_Sub2.outgoingGameIsaac);
Class348_Sub42_Sub14.queuePacket(37, ... | 6 |
public void vitesseMoins(int $param_int_1)
throws java.rmi.RemoteException
{
try {
ref.invoke(this, $method_vitesseMoins_0, new java.lang.Object[] {new java.lang.Integer($param_int_1)}, 4692753105378022573L);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.rmi.RemoteException e) {
... | 3 |
private void read(FileInput fin){
this.nAnalyteConcns = fin.numberOfLines()-1;
this.titleZero = fin.readLine();
this.nResponses = this.nAnalyteConcns;
this.analyteConcns = new double[this.nAnalyteConcns];
this.responses = new double[this.nAnalyteConcns];
this.weights = ne... | 9 |
public static void addPerson(Role subRole) {
if (subRole instanceof CwagonerHostRole) {
host = (CwagonerHostRole)subRole;
host.setNumTables(numTables);
for (CwagonerWaiter iWaiter : Waiters) {
host.addWaiter(iWaiter);
}
}
else if (subRole instanceof CwagonerCashierRole) {
... | 9 |
@Override
public boolean equals(Object anObject) {
if (this == anObject) return true;
if (anObject == null || getClass() != anObject.getClass()) return false;
Element element = (Element) anObject;
if (emptyElementTag != element.emptyElementTag) return false;
if (!attributeN... | 8 |
public String parseCommand(String inputCommand)
{
if(inputCommand.equals("")) {
return "No command entered!";
}
ArrayList<String> commands = new ArrayList<String>();
for(String command : inputCommand.split(" ")) {
commands.add(command);
}
if... | 9 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)&&(affected instanceof Room))
{
final Room R=(Room)affected;
DeadBody B=null;
for(int i=0;i<R.numItems();i++)
{
final Item I=R.getItem(i);
if((I instanceof DeadBody)
&&(I.container()==null)
&&(!((DeadBody)... | 8 |
@Override
public void performClassification(
HashMap<Integer, RawImageInstance> rawInstances,
HashMap<Integer, Instances> entireData, Instances trainData,
HashMap<Integer, Instances> testData) throws Exception {
System.err.println("Evalutating accuracy...");
int numClassifiers = classifiers.length;
// ... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PackageMetaResource other = (PackageMetaResource) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pos other = (Pos) obj;
if (x != other.x)
return false;
if (y != other.y)
return false;
return true;
} | 5 |
public static SampleSet generateData(
final int samples, final float rel, final Random rnd
) {
//
final SampleSet result = new SampleSet();
//
int size1 = (int)(samples * rel);
int size2 = samples - size1;
//
int size = size1 + size2;
while... | 6 |
private boolean r_mark_suffix_with_optional_s_consonant() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 143
// or, line 145
lab0: do {
v_1 = limit - cursor;
lab1: do {
// (, line 144
// (, line 144
// test, line 144
v_2 = limit - cursor;
// lit... | 9 |
private byte[] makeHeader(int number) {
byte[] header = new byte[HEADER_SIZE];
if(number >= (1 << (8* HEADER_SIZE))) {
throw new InputMismatchException("The round number " + number + " exceeds the bound of " + (1 << (8*HEADER_SIZE)));
}
int i = 0;
do {
header[i] = (byte) (number % 256);
number >>= 8;... | 2 |
@Override
public List<ConcertInfo> getConcertsForArtist(String artist) throws LastFmConnectionException {
if(artist==null) throw new IllegalArgumentException("artist");
SimpleDateFormat simpleDate = new SimpleDateFormat("EEE, dd MMM YYYY", Locale.US);
DocumentBuilderFactory domFactory = DocumentBuilderFactory.ne... | 4 |
@Test
public void TestAll() throws IOException, SyntaxFormatException {
for (File file : new File("src/test/resources/testprogs/").listFiles()) {
if (file.isFile()) {
if (file.getPath().indexOf(StatementTest.simpleFuncTest4) >= 0) {
continue;
}
if (!file.getPath().endsWith(".txt")) {
continu... | 4 |
protected void addBlockToArea(final Block block, final Player player, final PlanArea area, final Material type,
final short durability) {
if (area.isCommitted()) {
// If committed area, means that we're changing the structure underlying the plan, so
// replace the original.
area.addOriginalBlock(bl... | 2 |
@Override
public boolean isMine(String command) {
Iterable<String> ans = Splitter.on(' ').omitEmptyStrings().split(command);
arguments.clear();
CollectionUtils.addAll(arguments, ans.iterator());
if (arguments.get(0).equals(commandName)) {
if (argumentNumber != 0 && argume... | 3 |
public static void figureOutConnect(PrintStream w, Object... comps) {
// add all the components via Proxy.
List<ComponentAccess> l = new ArrayList<ComponentAccess>();
for (Object c : comps) {
l.add(new ComponentAccess(c));
}
// find all out slots
for (Compone... | 7 |
private void resetPosition(Tile current, int row, int col) {
if (current == null)
return;
int x = getTileX(col);
int y = getTileY(row);
int distX = current.getX() - x;
int distY = current.getY() - y;
if (Math.abs(distX) < Tile.SLIDE_SPEED) {
current.setX(current.getX() - distX);
}
if (Math.abs(dis... | 7 |
public MenuBar() {
// FILE
JMenu menuFile = new JMenu("File");
this.add(menuFile);
JMenuItem itemOpenSource = new JMenuItem("Open source file");
itemOpenSource.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {... | 2 |
public int get_bits(int number_of_bits)
{
int returnvalue = 0;
int sum = bitindex + number_of_bits;
// E.B
// There is a problem here, wordpointer could be -1 ?!
if (wordpointer < 0) wordpointer = 0;
// E.B : End.
if (sum <= 32)
{
// all bits contained in *wordpointer
returnvalue... | 3 |
Module getSubModule(String name) {
if (StringUtils.isEmpty(name) || !hasSubModules()) {
return null;
}
for (Module module : this.subModules) {
if (name.equals(module.name)) {
return module;
}
}
return null;
} | 4 |
public void setBtn_Std_Fontstyle(Fontstyle fontstyle) {
if (fontstyle == null) {
this.buttonStdFontStyle = UIFontInits.STDBUTTON.getStyle();
} else {
this.buttonStdFontStyle = fontstyle;
}
somethingChanged();
} | 1 |
public void update() {
if (fireRate > 0) fireRate--;
int xa = 0, ya = 0;
if (anim < 7500) anim++;
else
anim = 0;
if (input.up) ya--;
if (input.down) ya++;
if (input.left) xa--;
if (input.right) xa++;
if (xa != 0 || ya != 0) {
move(xa, ya);
moving = true;
} else {
moving = false;
}
cl... | 8 |
public static DCLayer createLayer(ConstantProvider cp, int sector, int superlayer, int layer) {
if(!(0<=sector || sector<6)) {
System.err.println("Error: sector should be 0...5");
return null;
}
if(!(0<=superlayer || superlayer<6)) {
System.err.println("Error:... | 8 |
public static String checkKeys(final String keyName, final String[] keyNames) {
String result = null;
if (keyNames != null && keyNames.length > 0 && keyName != null) {
for (int i = 0; i < keyNames.length; i++) {
if (keyName == keyNames[i]) {
result = keyNames[i];
break;
}
}
if (result =... | 6 |
private void setPreferredClasses() {
if (!_classLocked) {
_classBox.removeActionListener(_classListener);
_classBox.removeAllItems();
Vector<BaseClass> preferred = _character.getRankedClasses(16);
Vector<BaseClass> average = _character.getRankedClasses(15);
... | 4 |
public OptionsMenu() {
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e)
{
e.printStackTrace();
}
frame.setResizable(false);
frame.setTitle("OptionsMenu");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(width, 380);
frame.setLocat... | 1 |
public void OpenFile(int primary) throws FileNotFoundException{
JFileChooser fileChooser = new JFileChooser("C:\\Users\\Aishwarya\\Documents\\NetBeansProjects\\NewVideoPlayer");
int status = fileChooser.showOpenDialog(this);
if(status == 0)
{
try {
R... | 2 |
public void populate(){
tiles = new Tile[Map.CHUNK_SIZE][Map.CHUNK_SIZE];
SimplexNoise noise = new SimplexNoise(7, 0.1);
double xStart = chunkXPos * Map.CHUNK_SIZE;
double yStart = chunkYPos * Map.CHUNK_SIZE;
double xEnd = xStart + Map.CHUNK_SIZE;
double yEnd = yStart + Map.CHUNK_SIZE;
int xRe... | 5 |
private void addPlayerBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPlayerBtnActionPerformed
String playerName = playerNameText.getText();
playerNameText.setText("");
try {
DBController.addPlayer(playerName);
} catch (ClassNotFoundException ex) {
... | 6 |
@Override
public boolean supportsEditability() {return false;} | 0 |
public boolean Apagar(Telefone obj){
try{
PreparedStatement comando = banco
.getConexao().prepareStatement("UPDATE telefones SET ativo = 0 WHERE id = ?");
comando.setInt(1, obj.getId());
comando.executeUpdate();
comando.getConnection().commit()... | 1 |
public void hurt(Entity var1, int var2) {
if(!this.level.creativeMode) {
if(this.health > 0) {
this.ai.hurt(var1, var2);
if((float)this.invulnerableTime > (float)this.invulnerableDuration / 2.0F) {
if(this.lastHealth - var2 >= this.health) {
return;
}
this.health = this.lastHealth - v... | 6 |
@Override
public void processKeyEvent(Component c, KeyEvent e) {
try {
if (c instanceof OutlinerCellRendererImpl) {
OutlinerCellRendererImpl renderer = (OutlinerCellRendererImpl) c;
JoeTree tree = renderer.node.getTree();
if (renderer.node != tree.getEditingNode()) {
tree.getDocument().panel.layo... | 3 |
@Override
public String toString() {
if (meetings.size() == 0) {
return "{}";
}
StringBuilder sb = new StringBuilder();
sb.append(meetings.size());
sb.append("\\{");
for (Integer key : meetings.keySet()) {
sb.append(key);
sb.append(... | 2 |
public void add(byte[] packedValue, int docID) throws IOException {
if (packedValue.length != packedBytesLength) {
throw new IllegalArgumentException("packedValue should be length=" + packedBytesLength + " (got: " + packedValue.length + ")");
}
if (pointCount >= maxPointsSortInHeap) {
if (offli... | 8 |
protected void optimize2() throws Exception {
//% main routine for modification 2 procedure main
int nNumChanged = 0;
boolean bExamineAll = true;
// while (numChanged > 0 || examineAll)
// numChanged = 0;
while (nNumChanged > 0 || bExamineAll) {
nNumChanged = 0;
// if (examin... | 9 |
public static Fst<Pair<Character, Character>> fromString(CharSequence string) {
Fst<Pair<Character, Character>> bla = new Fst<>();
if (string.length() == 0) {
bla.addState(StateFlag.ACCEPT, StateFlag.INITIAL);
return bla;
}
State previous = null;
for (int i = 0; i < string.length(); i++) {
State s... | 4 |
public int getStudentId() {
return studentId;
} | 0 |
private boolean ValidPetNameChars(String inputStr,int HardCodedLen)
{
for(int i=0;i<HardCodedLen;i++)
{
if(i==0)
{
if(inputStr.charAt(0) == ' ')
{
return false;
}
}
if((inputStr.charAt... | 7 |
public static void parse(String filename, int n) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
String line = null;
// drop the header line
line = br.readLine();
int abs_min = Integer.MAX_VALUE, abs_max = Integer.MIN_VALUE, tmp0, tmp1;
double... | 9 |
@Override
public Polynomial gcd(Polynomial polynomial1, Polynomial polynomial2) {
if (!isZero(polynomial1) && isZero(polynomial2)) {
return polynomial1;
}
if (isZero(polynomial1) && !isZero(polynomial2)) {
return polynomial2;
}
if (isZero(polynomial1)... | 7 |
public static String decode(String text) {
if (text == null)
return null;
StringBuilder buf = new StringBuilder(text.length());
final int limit = text.length();
for (int i = 0; i < limit; i++) {
char ch = text.charAt(i);
// Handle unescaped characters... | 9 |
@Override
public void run() {
String data = this.plugin.getFileMan().read(this.plugin.chatFile());
JSONArray jArray;
try {
jArray = (JSONArray) new JSONParser().parse(data);
for(int i=0;i<jArray.size();i++){
JSONObject json = (JSONObject) jArray.get(i);
String time = (String) json.get("time");
... | 6 |
private static void generateParameterReifierCode(String[] paramTypes, boolean isStatic, final CodeVisitor cv) {
cv.visitIntInsn(SIPUSH, paramTypes.length);
cv.visitTypeInsn(ANEWARRAY, "java/lang/Object");
int localVarIndex = isStatic ? 0 : 1;
for (int i = 0; i < paramTypes.length; ++i) {
String param = param... | 8 |
private static Token matchOperator(String word, int line, int position){
// Try building a symbol
for (Operator testOp: Operator.values()) {
String testOpStr = testOp.getValue();
int testOpLen = testOpStr.length();
if (testOpLen <= word.length()){
String testWord = word.substring(0, testOpLen);
if ... | 3 |
public void testWeekdayNames() {
DateTimeFormatter printer = DateTimeFormat.forPattern("EEEE");
for (int i=0; i<ZONES.length; i++) {
MutableDateTime mdt = new MutableDateTime(2004, 1, 1, 1, 20, 30, 40, ZONES[i]);
for (int day=1; day<=366; day++) {
mdt.setDayOfYear... | 2 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((hausnummer == null) ? 0 : hausnummer.hashCode());
result = prime * result + ((land == null) ? 0 : land.hashCode());
result = prime * result + ((ort == null) ? 0 : ort.hashCode());
... | 5 |
private void drawHeliostats(Graphics2D g) {
List<Heliostat> heliostats = model.getHeliostats();
if (heliostats.isEmpty())
return;
Stroke oldStroke = g.getStroke();
Color oldColor = g.getColor();
Symbol.HeliostatIcon heliostatIcon = new Symbol.HeliostatIcon(Color.GRAY, Color.BLACK, false);
synchronized (h... | 7 |
@SuppressWarnings("unchecked")
public T removeEnd() {
ListNode<T> before = null;
ListNode<T> after = front;
T tempData;
if (isEmpty())
return null;
tempData = tail.getData();
if (size() == 2){
front.setNext(null);
... | 5 |
private String cardName(int number) {
String name = "";
name += cardRank(number);
name += " of ";
switch(number / 13) {
case(0): name += "Clubs"; break;
case(1): name += "Diamonds"; break;
case(2): name += "Hearts"; break;
case(3): name += "Spades"; break;
}
return name;
} | 4 |
@Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just created a thunder storm!");
return random.nextInt((int) agility) * 2;
}
return 0;
} | 1 |
private static void DownloadNewLauncher( ) {
try {
//progressCurr.setValue(0);
String strPath = Utils.getWorkingDirectory() + File.separator+GlobalVar.LauncherFileName;
File AppPath = new File(URLDecoder.decode(LauncherUpdater.class.getProtectionDomain().getCodeS... | 5 |
public boolean onStack(final LocalExpr expr) {
if (expr.isDef()) {
return false;
}
final UseInformation UI = (UseInformation) useInfoMap.get(expr);
if (UI == null) {
if (StackOptimizer.DEBUG) {
System.err
.println("Error in StackOptimizer.onStack: parameter not found in useInfoMap");
}
... | 6 |
@Override
public void write(ICTMC ctcm, String pathname) throws Exception {
BufferedWriter outputStrm = new BufferedWriter(new FileWriter(pathname));
Matrix tmpM;
List<Matrix> tmpTra;
int i = -1;
int max = -1;
int j = -1;
int maxT = -1;
try {
if(ctcm.isIrreducible()) {
tmpM = ctcm.getStaziona... | 8 |
public char[][] transpose_square(int[] key,char[][] square, boolean col_flag)
{
int row=square.length;
int col=square[0].length;
char[][] result=new char[row][col];
if(!col_flag)
{
for(int i=0;i<key.length;i++)
{
for(int j=0;j<row;j++)
{
result[j][i]=square[j][key[i]-1... | 5 |
public void tick()
{
if (queueTiles.size() == 0)
{
if (owner.cities.size() == 0)
{
//settle(); return;
}
Tile t = settleLocation();
//System.out.println(t.owner);
waddleToExact(t.row,t.col);
}
else
{
while (action > 0)
{
if (queueTiles.size() == 0)
{
Tile t = settle... | 7 |
public void defineObjects(){
CharacterManager.character = CharacterManager.defineChar();
PlatformManager.defineFloors(level);
LivingEntityManager.defineEnemies(level);
EntityManager.initialize();
EntityManager.setupEntities();
// define star locations
for (int i = 0; i < CharacterManager.starNumber; i++)... | 4 |
private String getPlayer() {
Player[] bufferPlayer = manager.getAllPlayer();
String s = "";
int counter = 0;
if(bufferPlayer[bufferPlayer.length -1] != null&&bufferPlayer[bufferPlayer.length -1].name.contentEquals("Bot")){
counter = 1;
}
... | 4 |
@Override
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return isJsonType(mediaType) &&
filteringEnabled(type, genericType, annotations, mediaType) &&
getJsonProvider().isWriteable(type, genericType, annotations, mediaType);
} | 3 |
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.