text stringlengths 14 410k | label int32 0 9 |
|---|---|
public IRegion getDamageRegion(
ITypedRegion partition,
DocumentEvent event,
boolean documentPartitioningChanged) {
if (!documentPartitioningChanged) {
try {
IRegion info =
fDocument.getLineInformationOfOffset(event.getOffs... | 5 |
protected @Override Token getNewToken() throws ScannerException {
charScanner.resetContext();
final StringBuilder repr = new StringBuilder();
try {
appendToContext(' ');
Char c;
Char.Class cc;
// consume whitespace
try {
do {
c = charScanner.getToken();
cc = c.getCharClass();
} wh... | 9 |
private void initializeCircleCollisionPoints(int radius, int edgeprecision,
int layers)
{
// Calculates the number of collisionpoints
int size = edgeprecision;
// From layer 2 onwards, center is added
if (layers >= 2)
size ++;
// Larger amount of layers means more collisionpoints
for (int i = 3; i <... | 5 |
private void attemptUse(Command command) {
if (!command.hasSecondWord()) {
System.out.println("Use what?\n");
return;
}
String name = command.getSecondWord();
// look for item in player's inventory and use it if found (only takeable items)
Item item = pla... | 5 |
@Override
public boolean createTable(String query) {
try {
if(query == null)
{
this.writeError("SQL Create Table query null", true);
return false;
}
if (query.equals("") || query == null) {
this.writeError("SQL Create Table query empty.", true);
return false;
}
Connection connection... | 4 |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... | 7 |
@Override
public void run() {
try {
while (true) {
String message = this.inQueue.take();
if (message.equals(User.KILL_MSG)) {
break;
} else if (message.equals(User.DO_NOTHING)) {
continue;
}
... | 5 |
@SuppressWarnings("rawtypes")
public boolean equals(Object other) {
if (other instanceof Pair) {
Pair otherPair = (Pair) other;
return
(( this.first == otherPair.first ||
( this.first != null && otherPair.first != null &&
this.first.equals(otherPair.first))) &&
( this.sec... | 8 |
static int[][][] floydWarshall(int[][] mAdy){
int N; int[][][] res = new int[N=mAdy.length][N][2];
for(int i=0;i<N;i++)for(int j=0;j<N;j++)res[i][j]=new int[]{mAdy[i][j], j};
for(int k=0;k<N;k++)
for(int i=0;i<N;i++)for(int j=0;j<N;j++)
if(res[i][k][0]<MAX_VALUE&&res[k][j][0]<MAX_VALUE)
if(res[i][j][0... | 8 |
private Board randomMove(Board board, boolean myTurn, boolean needChained) {
Checker curChecker;
Board pieces;
//Copy the board and get the first piece.
if (!needChained) {
pieces = board.copy();
curChecker = pieces.pop();
//If the move requires a chain we do not copy the board and continue o... | 7 |
public Material toolPicker() {
int next = gen.nextInt(10);
switch (next) {
case 1:
return getHelmet();
case 2:
return getChestPlate();
case 3:
return getLeggings();
case 4:
return getBoots();
case 5:
return getHoe();
case 6:
return getPickaxe();
case 7:
return getAxe();
case 8:
... | 9 |
public boolean getBoolean(String key) throws JSONException {
Object object = get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE) ... | 6 |
public void handleInput(InputManager input)
{
// Check if the left mouse button is down.
if (input.isMouseButtonDown(1))
{
// Transform the mouse coordinates into world space.
// Check if the Body has been clicked on.
if ((input.mouseEventPosition().x <= (_Body.getLayeredPosition().x + (_Body.getShape(... | 5 |
public static String rearrangeString(String input, int distance) {
Map<Character, Integer> frequencyCounter = new HashMap<>();
PriorityQueue<Pair> heap = new PriorityQueue<Pair>(input.length(), new Comparator<Pair>(){
@Override
public int compare(Pair o1, Pair o2) {
... | 7 |
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final MethodCall that = (MethodCall)o;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (params != null ?... | 9 |
@Before
public void setUp() throws Exception {
Character pc = 'A';
product = new Product(pc);
product.writePriceForQuantity(1, BigDecimal.valueOf(10.00));
product.writePriceForQuantity(5, BigDecimal.valueOf(25.00));
product.writePriceForQuantity(7, BigDecimal.valueOf(50.00));
} | 0 |
@SuppressWarnings("resource")
public void readLine(char type){
try {
if(lines.size() == 0){
File quotes = new File("quotes.txt");
Reader reader;
reader = new FileReader(quotes);
BufferedReader lineReader = new BufferedReader(reader);
String line;
while ((line = lineReader.readLine()) != nu... | 6 |
@Override
public void setBoolean(long i, boolean value)
{
if (ptr != 0) {
Utilities.UNSAFE.putByte(ptr + i, value == true ? (byte) 1 : (byte) 0);
} else {
if (isConstant()) {
throw new IllegalAccessError("Constant arrays cannot be modified.");
... | 4 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int n = to.length();
char[] circle = new char[n];
/*
* First fill the circle buffer with as many characters as are in the
* to string. If we... | 9 |
@Override
public void leave(String n) {
try {
m_server.pushMessage(new Leave(n));
} catch (RemoteException e ) {
e.printStackTrace();
} catch (InterruptedException e){
e.printStackTrace();
}
} | 2 |
public void setFecha(Date fecha) {
this.fecha = fecha;
} | 0 |
public static int isHerbloreSkill(Item first, Item other) {
Item swap = first;
Ingredients ingredient = Ingredients.forId(first.getId());
if (ingredient == null) {
ingredient = Ingredients.forId(other.getId());
first = other;
other = swap;
}
if (ingredient != null) {
int slot = ingredient.getSlot(... | 6 |
public void setName(String name) {
this.name = name;
} | 0 |
void handlePacket(byte[] hidReport, int packetLen) throws
IOException,
AWTException {
// decode keys, only process up to NUM_KEYS
int modifier = hidReport[2];
int nrKeys = packetLen - 4;
if (nrKeys > NUM_KEYS){
nrKeys = NUM_KEYS;
}
... | 9 |
@Override
public void fail(LeakCheckEntry entry) {
StringBuilder message = new StringBuilder();
message.append("A memory leak has been detected!").append("\r\n");
message.append("\t").append("offending object: ").append(entry.description).append("\r\n");
if (entry.o != null && entry.o.get() != null) {
messa... | 2 |
* 初始数据内容
* @return
*/
public boolean registerProvider(ServiceMetadata metadata) {
try {
if (!exits("/"+metadata.getInterfaceName()))
zookeeper.create("/"+metadata.getInterfaceName(),
"provider".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
String path = zookeeper.creat... | 4 |
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://download.oracle.com/j... | 6 |
@Override
public int top() {
if (amount > 0) {
return head.getValue();
} else {
return error;
}
} | 1 |
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
MovingObjectPosition var4 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);
if (var4 == null)
{
return par1ItemStack;
}
else
... | 8 |
public void setOtherSource(SaltAlgorithmIdentifierType value) {
this.otherSource = value;
} | 0 |
protected void printFileContents(PrintWriter writer) {
int nrOfConcentrations = times.size();
int nrOfClusters = clusters.size();
for (int i = 0; i < nrOfConcentrations; i++) {
writeToFile(times.get(i), false);
for (int j = 0; j < nrOfClusters; j++) {
List<Integer> timeSerieIndexes = clusters.get... | 4 |
public void testIntegerMap(Map<Integer,Object> map){
Integer[] keys=new Integer[itemCount];
Object[] values=new Object[itemCount];
for(int i=0;i<itemCount;i++){
keys[i]=i;
values[i]=Double.valueOf(random.nextDouble());
}
map.clear();
assertTrue(map.isEmpty());
for(int i=0;i<itemCount;i++){
... | 9 |
private int leftGenerateX(Object obj)
{
if (obj.getClass().equals(DynamicImagePanel.class))
{
int finalX = ((DynamicImagePanel)obj).getX() + ((DynamicImagePanel)obj).getWidth();
finalX = finalX + ((DynamicImagePanel)obj).getParent().getX();
return finalX;
}
else if (obj.getClas... | 3 |
public void setMargaritas(int margaritas) {
this.margaritas = margaritas;
} | 0 |
private void stopEditing(boolean cancel) {
if (editingTable == null)
return; // Nothing to do.
try {
editingTable.getCellEditor().stopCellEditing();
} catch (NullPointerException e) {
} catch (IllegalArgumentException e) {
System.err.println("Odd 'focusCycleRoot' exception thrown "
+ "from the de... | 6 |
protected void processAction() {
log.info("Process Clicked");
saveFields();
StringBuffer errors = new StringBuffer();
if (reportFolder.getText().isEmpty()) {
errors.append("You must specify a report folder\r\n");
}
if (errors.length() > 0) {
log.info("Errors: " + errors.toString());
Run.s... | 6 |
@Test
public void getIncome() {
AmateurAthlete test = null;
AmateurAthlete test1 = null;
try {
test = new AmateurAthlete("Franz", 3);
test1 = new AmateurAthlete("Karl", 5);
} catch (Exception e) {
// expected
}
try {
AmateurAthlete test3 = new AmateurAthlete("Sepp", 12);
} catch (ValueExcepti... | 5 |
public HWindow(Widget parent, String title, boolean closable) {
super(new Coord(234, 29), new Coord(430, 100), parent);
canhastrash = false;
this.title = title;
shp = (IHWindowParent)parent;
shp.addwnd(this);
if(closable)
cbtn = new IButton(new Coord(sz.x - cbtni[0].getWidth(), 0), this, cbtni[0], cbtni[1], ... | 1 |
public void writeReducedOtuSpreadsheetsWithTaxaAsColumns(
File newFilePath, int numTaxaToInclude) throws Exception
{
HashSet<String> toInclude = new LinkedHashSet<String>();
HashMap<String, Double> taxaSorted =
getTaxaListSortedByNumberOfCounts();
numTaxaToInclude = Math.min(numTaxaToInclude, taxaSort... | 9 |
private static int showMainPrompt(){
String displayStr = "1) Add a new T/F question\n"
+"2) Add a new multiple choice question\n"
+"3) Add a new short answer question\n"
+"4) Add a new essay question\n"
+"5) Add a new ranking question\n"
+"6) Add a new matching question\n"
+"7) Finish";
int choice... | 2 |
public void startElement(String uri, String localName, String qName,
Attributes attrs) throws SAXException {
// determine mode and call appropriate method
if (mode == "getschema")
// find the schema location
startGetSchemaElement(qName, attrs);
if (mode == "schemadefs")
// get schema defaults
start... | 4 |
public static void main(String[] args) {
String Style = "Nimbus";
//String Style = "Metal";
//String Style = "Windows";
//<editor-fold defaultstate="collapsed" desc=" Carga estilo de Interfaz ">
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIMan... | 6 |
private String timeToString(int hour, int minute, int second, int millisecond)
{
String result = "";
if (classicTime)
{
result += twoDigitString(hour);
result += timeDelimiter;
result += twoDigitString(minute);
result += timeDelimiter;... | 4 |
public void enforceTrackerLimit() {
if ((this.inactiveLeafNodeCount > 0)
|| ((this.activeLeafNodeCount * this.activeLeafByteSizeEstimate + this.inactiveLeafNodeCount
* this.inactiveLeafByteSizeEstimate)
* this.byteSizeEstimateOverheadFraction > this.maxByteSizeOpt... | 9 |
public Characters(String name, int hp, int mana, int attack, int manaRegen, SkillSet skillSet)
{
this.name = name;
this.hp = hp;
this.mana = mana;
this.attack = attack;
this.manaRegen = manaRegen;
this.skillSet = skillSet;
this.alive = true;
} | 0 |
public static float doFrictionY(float xv, float yv, float FRICTION) {
float angle = (float) Math.atan(yv / xv);
if (xv == 0) {
if (yv == 0) {
angle = 0;
}
angle = (float) Math.PI / 2;
}
// apply friction
float fy = Math.abs(FRI... | 6 |
@Override
public void parseArgs(String[] args) {
if (args.length > 1) usage(null);
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (isOpt(arg)) {
usage("Unknow option '" + arg + "'");
} else {
// Command line
if (arg.equals("galaxy")) {
galaxy = true;
html = false;... | 5 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> already <S-... | 8 |
@SuppressWarnings("ConstantConditions")
@Test
public void testOTUConsensusConversion() {
File otuDir = new File("/home/alext/Documents/tuit/OTU Seq90/Seqs");
File tmpDir = new File("/home/alext/Downloads/tmp");
File executable = new File("/usr/local/bin/clustalw2");
File[] otuFil... | 9 |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... | 7 |
public void start() throws Exception {
File base = new File("./data/cache/");
for (int i = 0; i < THREADS_PER_REQUEST_TYPE; i++) {
workers.add(new JagGrabRequestWorker(new IndexedFileSystem(base, true)));
workers.add(new OnDemandRequestWorker(new IndexedFileSystem(base, true)));
}
for (RequestWorker<?,... | 4 |
public static Rule_VCHAR parse(ParserContext context)
{
context.push("VCHAR");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>();
int ... | 7 |
@Override
public int getNumUnclaimedHeads(String issuer) throws DataStorageException {
int count = 0;
Set<String> keys = this.config.getConfigurationSection("bounties").getKeys(false);
for (String key : keys) {
try {
Integer.valueOf(key);
Configur... | 5 |
private boolean isFontSmallEnough(Font font, String text) {
FontMetrics metrics = new FontMetrics(font) {};
Rectangle2D textBounds = metrics.getStringBounds(text, null);
Dimension panelBounds = contentLabel.getSize();
return textBounds.getWidth() <= panelBounds.getWidth() * (1.0f - TEXT_MARGIN_RATIO)
&& text... | 2 |
public Formula(StringBuffer formulaString) {
LinkedList<Integer> originalFormula = new LinkedList<Integer>();
variablesAffected = new Stack<LinkedList<Integer>>();
unitVariables = new TreeSet<Integer>();
// Temporary string that is used for reading each line of the file
String ... | 7 |
private void searchDown(boolean doReplace, boolean showWarnings) {
if (findNext(doReplace, false, page) == StringFinder.STRING_FOUND)
return;
page.getHighlighter().removeAllHighlights();
Object[] entry = embeddedTextComponents.values().toArray();
int n = entry.length - 1;
for (int i = 0; i < n; i++) {
i... | 8 |
public Integer getInt(String key)
{
Object val = get(key);
if (val == null)
return null;
else if (val instanceof Integer)
return (Integer)val;
else
return ((Double)val).intValue();
} | 2 |
protected void beforeCallForProposals() {
List<YellowPageCapsule> pagesToCallFor = new ArrayList<>();
for (Task t : leftOvers) {
boolean taskToQueryFor = true;
for (YellowPageCapsule yCap : yellowPagedCapsules) {
if (t.getRequiredCapability() == yCap.getTask().getRequiredCapability()) {
taskToQuer... | 7 |
private boolean readUntilMatch(byte[] match, boolean withinBlock) throws IOException {
int i = 0;
while (true) {
int b = fsin.read();
// end of file:
if (b == -1) return false;
// save to buffer:
if (withinBlock) buffer.write(b);
// check if ... | 8 |
public static Gson getGson()
{
return new GsonBuilder()
.registerTypeAdapter(GeoJsonObject.class, new GeoJsonObjectAdapter())
.registerTypeAdapter(LngLatAlt.class, new LngLatAltAdapter())
.create();
} | 0 |
public boolean hasNonPrimitiveProperty()
{
for(int x = 0;x<getPropertyCount();x++)
{
Class<?>prop = getReturnType(x);
if(!ObjectTools.isDatabasePrimitive(prop))
{
return true;
}
}
return false;
} | 3 |
final int[][] method3047(int i, int i_28_) {
if (i_28_ != -1564599039)
return null;
anInt9462++;
int[][] is = ((Class348_Sub40) this).aClass322_7033
.method2557(i_28_ ^ 0x5d41e2a6, i);
if (((Class322) ((Class348_Sub40) this).aClass322_7033).aBoolean4035) {
int i_29_ = 1 + (anInt9463 + anInt9463);
... | 7 |
public void mouseDragged(MouseEvent e)
{
String str = "x: " + e.getX() + ",y: " + e.getY();
System.out.println(str);
} | 0 |
public static void addFact(Node newFact){
//make a new clause for the new fact
String newClause;
if(newFact != null){
newClause = makeFact(newFact);
//System.out.println("Added New Fact " + newClause);
facts.add(newClause);
//add new clauses when our fact is unified with the given rules for a win
... | 4 |
private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... | 8 |
public boolean onItemUse(ItemStack var1, EntityPlayer var2, World var3, int var4, int var5, int var6, int var7) {
if(var3.getBlockId(var4, var5, var6) != Block.snow.blockID) {
if(var7 == 0) {
--var5;
}
if(var7 == 1) {
++var5;
}
if(var7 == 2) {... | 9 |
public JLabel getPlayer2Score() {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: getPlayer2Score() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: getPlayer2Score() - END");
return m_player2Score;
} | 4 |
@Basic
@Column(name = "POP_FECMOD")
public Date getPopFecmod() {
return popFecmod;
} | 0 |
private static void countMax() {
int counter = 0;
for (int i = 0; i < girlsNum; i++) {
if (isMagical[i] == 1 && isProtected[i] == 0) {
counter++;
}
}
if (counter > max) {
max = counter;
}
} | 4 |
public static String genericSyncAPICall(String region, String service, String operation, Object[] args)
{
//Retrieve a PvP.net client from the region.
LoLRTMPSClient client;
try
{
client = LoadBalancer.returnClient(region);
}
catch (NullClientForRegionException e1)
{
return "Connection to " + e1.... | 3 |
public int reverseBits(int n) {
if (n == 0) {
return 0;
}
if( n == Integer.MIN_VALUE){
return 1;
}
char[] arr = Integer.toBinaryString(n).toCharArray();
char[] narr = null;
if(arr.length<32){
narr = new char[32];
for(int i=narr.length-1,j=arr.length-1;i>=0;i--){
if(i>=narr.length-arr.len... | 9 |
public void incRegister() {
this.wert++;
if(this.wert == 256) {
this.wert = 0; // Überlauf
}
} | 1 |
public void insert(Connection conn) throws SQLException {
if (isValid())
{
PreparedStatement stmt = conn.prepareStatement("INSERT INTO crminterests VALUES (?, ?)");
stmt.setInt(1, id);
stmt.setString(2, favouriteSport);
stmt.execute();
}
} | 1 |
public static void run(String[] args) throws IOException, InterruptedException
{
Runtime rt = Runtime.getRuntime();
Process ps;
boolean vMode = false;
if(args[0].equalsIgnoreCase("-v"))
{
System.out.println("Verbose mode");
vMode = true;
}
String cmd0[] = {"yum","-y","install","g... | 7 |
public static void main(String[] args) {
ArrayList<Integer> bArr = new ArrayList<>();
for (int i = 2; i < 1000; i++) {
if (p7primefinder.isPrime(i)) {
bArr.add(i);
bArr.add(i * -1);
}
}
int maxA = 0, maxB = 0, maxPrime = 0;
... | 7 |
public static BloomSpecification computeBucketsAndK(double maxFalsePosProb){
// Handle the trivial cases
if(maxFalsePosProb >= probs[minBuckets][minK]) {
return new BloomSpecification(2, optKPerBuckets[2]);
}
if(maxFalsePosProb < probs[maxBuckets][maxK]) {
return ... | 4 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
Map<String, Object> rpta... | 8 |
public int read(byte[] samples, int offset, int length)
throws IOException
{
// read and filter the sound samples in the stream
int bytesRead = super.read(samples, offset, length);
if (bytesRead > 0) {
soundFilter.filter(samples, offset, bytesRead);
return byt... | 4 |
public void reportDead(Bee deadBee) {
if (_currentPopulation <= 0 || !_simulation.environment().removeBee(deadBee)) {
// Exception is caught by Tortuga framework
// throw new RuntimeException("A bee of an empty hive wanted to die. This is impossible.");
System.err.println("A bee of an empty hive wanted to di... | 3 |
@Override
/**
* performs the SimulationEvent
* @return EventDone - the event that was performed with flag set to true if the event was actually performed
*/
public EventDone performEvent(SimulationEvent reaction) {
// specify the fromAgent in the case of infection or exposure
... | 5 |
private void spawn() {
for (int i = 0; i < nr; i++) {
if (type == Type.PARTICLE) {
Game.level.addEntity(new Pieces(x, y));
} else if (type == Type.STEP) {
Game.level.addEntity(new Step(x, y));
} else if (type == Type.BLOOD) {
Game.level.addEntity(new Blood(x, y));
} else if (type == Type.SPAR... | 5 |
public void doAllTheThings() {
//clear
currentChord = 0;
for (int i = currentChord; i < bass.length; ++i) //clear chords later since this change
{
tenor[i] = null;
alto[i] = null;
soprano[i] = null;
}
ArrayList<ArrayList<Object[]>> mas... | 9 |
private static J_JsonNodeSelector func_27352_a(Object[] var0, J_JsonNodeSelector var1) {
J_JsonNodeSelector var2 = var1;
for(int var3 = var0.length - 1; var3 >= 0; --var3) {
if(var0[var3] instanceof Integer) {
var2 = func_27345_a(func_27354_b(((Integer)var0[var3]).intValue()), var2);
... | 3 |
public void run() {
try {
while (true) {
File file = new File("online_players.json");
file.delete();
BufferedWriter w = new BufferedWriter(new FileWriter(file, true));
String json = "{";
for (ServerThread t : Server.threads) {
String name = t.name;
ArrayList<ChatPlayer> players = Pla... | 7 |
private boolean openPage() {
File lastFile = fileChooser.getSelectedFile();
boolean success = false;
Frame frame = JOptionPane.getFrameForComponent(this);
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.addChoosableFileFilters(new String[] { "png", "gif", "jpg", "txt", "mws", "pdb", "xyz", "cml" })... | 9 |
public static int mult(int x, int y){
if (x == 0 || y == 0) {
return 0;
} else if (x < 0 || y < 0) {
return -1;
} else {
return x*y;
}
} | 4 |
public String getStatusPercent() {
Map<String, Double> map = analytic.getStatusPercent();
StringBuilder sb = new StringBuilder();
List<Entry<String, Double>> entries = new ArrayList<Entry<String, Double>>(map.entrySet());
Collections.sort(entries, new Comparator<Entry<String, Double>>() {
public int co... | 1 |
private void rechercherPostesVisibles(){
for(Poste poste : postes){
poste.initialiserPostesVisibles() ;
for(int orientation = Orientation.NORD ; orientation <= Orientation.NORDOUEST ; orientation += 1){
Position positionCible = Position.voisin(poste.getPosition(),orientation) ;
if(Position.estPositionVa... | 5 |
private void readXML() throws IOException {
try {
doreadXML();
} catch (Exception e) {
e.printStackTrace();
}
//bulding the construction view straight from vc
if (!con.init) {
setConst();
con.setInit(true);
}
con.setC... | 5 |
public boolean input(Instance instance) throws Exception {
if (getInputFormat() == null) {
throw new IllegalStateException("No input instance format defined");
}
if (m_NewBatch) {
resetQueue();
m_NewBatch = false;
}
Method m = (Class.forName(m_Class)).getMethod(m_Method, new Clas... | 9 |
@Basic
@Column(name = "PRP_CC_RESPONSABLE")
public Integer getPrpCcResponsable() {
return prpCcResponsable;
} | 0 |
public void visit_dstore(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 2 > maxLocals) {
maxLocals = index + 2;
}
if (inst.useSlow()) {
if (index < 256) {
addOpcode(Opcode.opc_dstore);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
... | 8 |
private String decodeMessage(ContactItem to, String Message) {
StringBuffer msg = new StringBuffer(Message);
int previndex = 0;
for(int i = 0; i < Message.length(); i++) {
int v = Message.indexOf('%', previndex);
if(v == -1) {
break;
... | 7 |
private NoeudArbre rechercheClefArbre(E clef, NoeudArbre<E> noeudCourant) {
NoeudArbre<E> result = NIL;
if (noeudCourant.clef.compareTo(clef) == 0) {
result = noeudCourant;
} else if (noeudCourant.clef.compareTo(clef) < 0) {
if (noeudCourant.filsDroit != NIL) {
... | 5 |
public void setAbsolutePath(boolean is_absolute_path) {
this.is_absolute_path = is_absolute_path;
this.path = assemblePath(this.path_list);
} | 0 |
public double get (int i)
{
switch (i)
{ case 0:
{ return x;
}
case 1:
{ return y;
}
case 2:
{ return z;
}
default:
{ throw new ArrayIndexOutOfBoundsException (i);
}
}
} | 3 |
public double checkAccuracy(int method, DataSet trainSet, DataSet testSet)
{
int correctCount = 0;
int wrongCount = 0;
String predictedCorrect = "";
for(int i=0; i < testSet.correctWords.size(); i++)
{
String actualCorrect = testSet.correctWords.get(i);
String wrong = testSet.wrongWords.get(i);
... | 5 |
protected void precess() {
double ra1 = pa.getRA() * Math.PI / 12.0;
double dec1 = pa.getDec() * Math.PI / 180.0;
Vector v = new Vector(Math.cos(dec1)*Math.cos(ra1),
Math.cos(dec1)*Math.sin(ra1), Math.sin(dec1));
double epoch1 = pa.getEpoch();
char etype1 = pa.getEpochType();
switch (etype... | 5 |
public void checkInvariants(){
if (super.getCompteARebours() > 10 || super.getCompteARebours() <0){
throw new InvariantError("Compte a rebours de la bombe non permis");
}
if(super.vaExploser()){
if (super.getCompteARebours() != 0){
throw new InvariantError("Vaexploser vrai mais compte a rebours != 0");
... | 4 |
public static void loadAllFiles() {
File texDir = new File("res/tex/");
ArrayList<File> texFiles = new ArrayList<>();
texFiles.addAll(Arrays.asList(texDir.listFiles()));
for (File f : texFiles) {
if (!f.isDirectory() && f.getName().endsWith(".png")) {
try {
... | 8 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.