method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
506bb6a9-b76e-4b82-9977-050b8744249f | 4 | public int getBottomX(Container parent) {
if (bottomComponents.size() == 1) {
return hgap;
}
int x = 0;
Component[] components = parent.getComponents();
for (int index = 0; index < components.length; index++) {
Component component = components[index];
if (bottomComponents.contains(component)) {
i... |
6dc70911-7661-450b-a48d-c1632bb51df5 | 8 | public static void qsHelpQuant( int lo, int hi, LinkedList<Stock> d ) {
if ( lo >= hi )
return;
int tmpLo = lo;
int tmpHi = hi;
double pivot = d.get(lo).getPrice();
Stock pivotStock = d.get(lo);
while( tmpLo < tmpHi ) {
//first, slide markers in as far as possible without swaps
while( d.get(tmpL... |
bdf3b655-326d-4cef-858e-1e5d56ac4401 | 6 | private void processCommand(Command command) {
if (command.commandIsUnknown()) {
System.out.println("I don't know what you mean...");
} else {
String commandWord = command.getCommandWord();
// process all possible commands
if (commandWord.equals("help")) {... |
1d4f38c0-7ae3-4d8f-9a0e-fb92f9f3643d | 8 | @SuppressWarnings("static-access")
@Override
public void paint(Graphics g) {
if (!lost) {
g.drawImage(mainBg, 0, 0, this);
g.setFont(font);
g.setColor(Color.BLUE);
g.drawString("Score: " + Stats.getTotalPoints(), 5, 20);
g.drawString("Lives: " + Stats.getLives(), 5, 40);
g.drawString("Level: " + ... |
a7a30472-44d3-4a19-becf-9cf98941bbf7 | 3 | public String consumeCssIdentifier() {
int start = pos;
while (!isEmpty() && (matchesWord() || matchesAny('-', '_')))
pos++;
return queue.substring(start, pos);
} |
135a9fc6-c35a-4c60-845c-1b617d737273 | 3 | public BigInteger getPrivateKey(String keyFileName) throws FileNotFoundException, IOException{
File f=new File(keyFileName);
FileInputStream fis=new FileInputStream(f);
ObjectInputStream ois = new ObjectInputStream(fis);
try {
n = (BigInteger) ois.readObject();
BigInteger e = (BigInteger)... |
f882aee0-18fa-474d-bb77-59e2007c8572 | 1 | public void testCompactExternalIds() {
System.out.println("\n*** testCompactExternalIds ***");
try {
final Object obj = CycAccess.baseKB;
final String id = "Mx4rvViBEZwpEbGdrcN5Y29ycA";
assertEquals(id, DefaultCycObject.toCompactExternalId(obj, getCyc()));
assertEquals(obj, DefaultCycObj... |
83cfb32d-edef-418f-a663-88b829424dec | 1 | private void deepLearn(){
DL_layers++;
//Add another layer
if (DL_layers < DL_maxlayers){
int dl = drawNet.layers.get(1).length - DL_layers*DL_drawdelta,
pl = playNet.layers.get(1).length - DL_layers*DL_playdelta;
//if (Game.verbose)
System.out.println("PlayerAI: Adding DEEP LEARNING layer #"+DL_lay... |
b5dc5f06-e82e-4f64-b6da-0682823eb50a | 1 | public FloatBuffer fillAndFlipBuffer( FloatBuffer mat4Buffer )
{
FloatBuffer res = BufferUtils.createFloatBuffer( SIZE );
for ( int i = 0; i < 4; i++ )
res.put( m[i] );
res.flip();
return res;
} |
528e063c-71b7-4bf4-9bd9-18de4609777b | 7 | public boolean equals(ChessPiece p) {
if (p.TYPE != TYPE ||
p.COLOR != COLOR ||
p.RANGE != RANGE ||
p.ATTACK_SLOPES.length != ATTACK_SLOPES.length ||
p.hasMoved != hasMoved)
{
return false;
}
for (int i = 0;i < ATTACK_SLOPES.le... |
821804b7-0cff-457c-a5d7-8cfddb8cdf22 | 9 | @Override
/**
* Handle various button presses by calling the appropriate methods
* in the Face Panel.
*/
public void actionPerformed(ActionEvent e) {
if (e.getSource() == addEye){
myPanel.addEye();
}else if(e.getSource() == addFace){
myPanel.addFace();
}else if(e.getSource() == addNose){
myPanel.... |
c1bf50c8-912c-43a2-ac52-5c0e9d4c21b4 | 0 | public String getHostIdentifier() {
return this.hostId;
} |
09b494ce-134e-44f4-9808-72e447e81789 | 6 | public boolean deleteAll() throws IOException {
boolean success = true;
try {
success &= comments().isEmpty() || comments().deleteAll();
success &= images().isEmpty() || images().deleteAll();
success &= lockableModels().isEmpty() || lockableModels().deleteAll();
success &= posts().isEmpty() || p... |
74d13088-3e9f-4df0-a18a-528ad4237b11 | 2 | public static void main(String[] args) throws Exception {
final Runner runner = new Runner();
Thread t1 = new Thread(new Runnable() {
public void run() {
try {
runner.firstThread();
} catch (InterruptedException ignored) {
}... |
3127d3fc-5ce0-460a-b88d-4a4141688913 | 7 | public static void main(String[] args) {
// TODO Auto-generated method stub
int serch =100000; //調べたい数
int [] prime = new int[100000]; //定義する素数の数
prime[0]=2;
prime[1]=3;
int primeCount = 2;
for(int i1=4;i1<=serch;i1++){ //調べたい数までのカウント
if(i1>2&&i1%2==0){ //2の倍数除外
continue;
}else{
... |
f4de0a8b-cbb6-46eb-a16e-00efc19b19c7 | 4 | public void move() {
// InputManager API
setX( this.getX() +
InputManager.getX() * getMoveSpeed() * SceneManager.scene.delta
);
setY( this.getY() +
InputManager.getY() * getMoveSpeed() * SceneManager.scene.delta
);
/* Apply Map Border */
if (getX() < 0) setX(0)... |
19b4103b-209e-4a58-8eee-3bdabb88fca0 | 7 | protected void updateArc()
{
// arc was fully matched - save it
addToPath( arc );
if ( arc.to != forbidden )
{
ListIterator<Arc> iter = arc.to.outgoingArcs( graph );
while ( iter.hasNext() )
{
Arc a = iter.next();
if ( a.versions.intersects(versions)&&(!a.isParent()
||!a.hasChildInVersion... |
23e14653-299a-44ae-861b-1d365e80bb5c | 3 | private Area generateShadows(int x, int y, List<RoundRectangle2D.Float> shapes) {
Area shadows = new Area();
float shapeX, shapeY, width, height, arcWidth, arcHeight;
for (RoundRectangle2D.Float s : shapes) {
shapeX = s.x * 50;
shapeY = s.y * 50;
width = s.width * 50;
height = ... |
97f625fb-836d-432d-9bba-fe42cd0956b9 | 9 | @Override
public void update() {
RenderableBlock rb = workspace.getEnv().getRenderableBlock(getBlockID());
if (rb != null) {
int x = 5;
int y = 7;
if (rb.getBlock().isCommandBlock()) {
y -= 2;
x -= 3;
}
if... |
8f661eda-fa84-4479-bc10-8edd5805381d | 9 | private void searchRefImage(int block)
{
RGB[][] tg = targetMacroBlocks.get(block);
double max = Double.MAX_VALUE;
int mx = 0;
int my = 0;
//center of macroblock
int xpos = ((block % h) * 16) + 8;
int ypos = ((block / h) * 16) + 8;
for(int y = -p; y <= p; y++)
{
for(int x = -p; x <= p; x++)
{... |
24dc003c-2314-4e9c-bb6b-7075b44664f8 | 4 | public static final void exampleConnectingToCyc() {
System.out.println("Starting Cyc connection examples.");
try {
System.out.println("Successfully established CYC access " + access);
// The following code should only be called if you will be modifying the KB
// and one should typically use a... |
0a5bcb93-2ae1-4c4e-8664-7c9d6f5b89c6 | 2 | @Test
public void testBadFilename() {
GithubExploreMessageParser parser = new GithubExploreMessageParser();
try {
System.out.println(parser.parse(""));
// If we reach here, we've failed. It should throw an IllegalArgumentException
Assert.fail();
} catch (I... |
c9a980c9-519c-4d96-a475-62c8345e4ad7 | 1 | @Override
public MultiLevelCache getCache(String pool) {
MultiLevelCache cache = getCurrentLevelCache(pool);
if(highLevelManager != null) {
Cache highLevelCache = highLevelManager.getCache(pool);
cache.setHighLevelCache(highLevelCache);
}
return cache;
} |
63226c4d-6b4b-4c90-a981-871dd2178df1 | 7 | protected void checkCollisions() {
checkBoxCollisions();
if (ball.intersects(paddle.getBoundsInLocal())) {
incrementSpeed();
movingDown = false;
}
if (ball.intersects(borderTop.getBoundsInLocal())) {
incrementSpeed();
movingDown = true;
}
if (ball.intersects(borderBottom.getBoundsInLocal())) {
... |
14dd17ca-526b-4afa-b162-88b8e87b0705 | 2 | public boolean laserExists(Object player){
boolean result = false;
for(int i = 0; i < lasers.size(); i++){
if(lasers.get(i).getParent() == player){
result = true;
}
}
return result;
} |
ee3adb2e-fe46-403b-9dfe-53f675aae391 | 6 | @Override
public
List<? extends Data> getAllData() {
//
List<Class<? extends Data>> typeList =
_dataCenter.getEntityManager().getAllDataTypesFromEntity( _id );
//
List<Data> dataList = new ArrayList<Data>();
//
for( Class<? extends Data> type : typeList ){
try ... |
1350050f-d2b3-40bc-b487-27192d3fafa5 | 3 | @Deprecated
public <T extends Widget> T findchild(Class<T> cl) {
for (Widget wdg = child; wdg != null; wdg = wdg.next) {
if (cl.isInstance(wdg))
return (cl.cast(wdg));
T ret = wdg.findchild(cl);
if (ret != null)
return (ret);
}
return (null);
} |
dd05fcf2-7b3c-4e05-8da4-1e5bcc328a34 | 2 | @Override
public String toString() {
String name = getName();
String append = "";
if(name != null && !name.equals("")) {
append = "(\"" + this.getName() + "\")";
}
return "TAG_String" + append + ": " + value;
} |
d0aa8570-bf39-445a-bf33-f20ec2712494 | 6 | private String[] getArgs(String input, int numberOfArgs) {
if(numberOfArgs == -1) { //see Command NumberOfArgs for reason
if(!input.contains(" ")) {
return new String[]{""};
} else {
return new String[]{removeCommand(input)};
}
}
if(numberOfArgs <= 0) return null;
String[] args = new String[n... |
69a4586e-d3c0-41f1-b421-c84085a1d44e | 8 | public static void main(String[] args) throws Exception {
CriaBaseSongs sse = new CriaBaseSongs();
String inputFileName = args[0];
String outputFileName = args[1];
String errorFileName = args[2];
Scanner input = new Scanner(new File(inputFileName));
int lineNumber = 0;
if(new File("contagem.txt").exis... |
6ab59e41-dc1f-4aff-b5d5-15c867277858 | 6 | 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... |
89ef41d7-205d-498d-8a3e-13a91d82735e | 0 | @Override
public void mouseReleased(MouseEvent e) {
} |
45e541e2-c46b-43c7-9df9-1077c76c341b | 3 | private int startQueuedGridlets() {
int nStarted = 0;
Iterator<SSGridlet> iter = waitingJobs.iterator();
while (iter.hasNext()) {
SSGridlet gridlet = iter.next();
if(gridlet.getStartTime() >= 0 && gridlet.getStartTime() <= GridSim.clock()) {
runningJobs.add(gridlet);
iter.remove... |
da11b42b-48c9-4987-b154-5b6493a97429 | 6 | @Override
public boolean execute(RuleExecutorParam param) {
Rule rule=param.getRule();
String count=rule.getValue();
boolean value=false;
if(count.matches(".\\d")){
int cnt=Integer.parseInt(count);
Element element=Util.getElementBasedOnChange(param);
if(OnTypes.Attribute.equals(rule.getOn())){
int... |
98661054-ec80-4912-a37f-fad032a5ea8b | 2 | public boolean Salvar(Telefone obj, int idPessoa){
try{
if(obj.getId() == 0 ){
PreparedStatement comando = banco
.getConexao().prepareStatement("INSERT INTO telefones "
+ "(ddd,numero,id_pessoa,ativo) VALUES(?,?,?,1)");
... |
1498e830-1608-42f2-a853-5dbe82950f61 | 4 | public void setSubChildren() {
if (layers == null) {
return;
}
subchildren = new HashMap<RSInterface, RSInterface[]>();
for (RSInterface layer : layers) {
if (layer.hasChildren()) {
RSInterface[] children = new RSInterface[layer.children.size()];
for (int index = 0; index < children.length; index+... |
faa3d245-0efb-4ba5-8f91-025b58fe9394 | 9 | public String getMessage() {
if (!specialConstructor) {
return super.getMessage();
}
String expected = "";
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize = expectedTokenSequences[i].length;
... |
8783a8a2-940a-4a51-884d-c37f50a563dc | 1 | public void setTransient(Registry rg, AI a) {
registry = rg;
ai = a;
for(int i = 0; i < subGoals.size(); i++) {
subGoals.get(i).setTransient(rg, a);
}
} |
6f4424b8-735e-4ca2-b7b4-4e6d43db5c1c | 3 | public String translate(final String key) {
final String pattern = this.base.getString(key);
if (pattern.equals("")) {
this.plugin.getLogger().log(Level.FINEST, "String value not found for {0} in {1}", new Object[] { key, ( this.base.getCurrentPath().equals("") ? "(root)" : this.base.getCurr... |
cdd54fd4-4e32-4ddc-bf8a-ac646f7a15b4 | 6 | public int firstMissingPositive(int[] nums) {
int n = nums.length;
for (int i = 0; i < n; i++) {
if (nums[i] > 0 && nums[i] <= n && nums[nums[i] - 1] != nums[i]) {
int j = nums[nums[i] - 1];
nums[nums[i] - 1] = nums[i];
nums[i] = j;
i--;
}
}
for (int i = 0; i < n; i++) {
if (nums[i] != ... |
004d53e1-8260-4a09-8d75-3c2cceb18e29 | 0 | public void setLastCompletedBuild(Build lastCompletedBuild) {
this.lastCompletedBuild = lastCompletedBuild;
} |
771d8598-a6e1-412c-b931-151f46083e1b | 4 | public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {
if(node == null) return null;
HashMap<Integer, UndirectedGraphNode> visited = new HashMap<Integer, UndirectedGraphNode>();
HashMap<Integer, UndirectedGraphNode> newNodes = new HashMap<Integer, UndirectedGraphNode>();
... |
065730d5-5924-44c1-9caa-e4c784d05d60 | 1 | public ArrayList<String> getDiscNames() {
ArrayList<String> discNames = new ArrayList<String>();
for (Disc disc : discs.getDiscs()) {
discNames.add(disc.getName());
}
return discNames;
} |
724d3fdc-2b42-42a0-bec5-07f06389658e | 6 | @Override
protected long onFill()
{
// This algorithm transfers each of the stacks in the map to an array
// list of stacks. This algorithm will continue placing a buffer into
// each stack until the available memory is as taken as possible.
List<ByteBufferStack> stacks = new ArrayList<ByteBufferStack>();... |
26724821-0316-428a-9c30-a55f69721bb5 | 7 | public static Rule_dirField parse(ParserContext context)
{
context.push("dirField");
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>();
... |
c0f4b0ad-5eeb-4051-8576-b83d667e3e8c | 9 | @Override
public void flush(SegmentWriteState state) throws IOException, AbortingException {
// NOTE: caller (DocumentsWriterPerThread) handles
// aborting on any exception from this method
int maxDoc = state.segmentInfo.maxDoc();
long t0 = System.nanoTime();
writeNorms(state);
if (docState.... |
e55bec29-8d58-41ef-b651-4dd3727e831f | 1 | public void set(int pos, T t) {
if (items[pos] == null) size++;
items[pos] = t;
} |
2fa1e295-b0a8-4e29-b1c9-af622bd61c43 | 7 | public static void removeLinhaDoArquivo(String file, String lineToRemove) {
try {
File inFile = new File(file);
if (!inFile.isFile()) {
System.out.println("Parameter is not an existing file");
return;
}
//Construct the new file that will later ... |
8a35c439-8a3f-4d14-bafc-61a5ae393430 | 5 | public Endpoint getEndpoint (int index)
throws IOException
{
// FIXME: don't even try this if we're not the
// current altsetting !!
synchronized (endpoints) {
if (endpoints [index] == null) {
int offset = getOffset ();
int count = index;
do {
offset = nextDescriptorOffset (offset);
... |
cc9a71a7-2239-4a9b-8677-5f9bffe73636 | 3 | public boolean findAttribute(String attribute) {
return attribute.equalsIgnoreCase(characterName)
|| attribute.equalsIgnoreCase(corporationName)
|| attribute.equalsIgnoreCase(allianceName)
|| attribute.equalsIgnoreCase(factionName);
} |
535b1bd3-fc27-4fa0-b404-96be92f74b8e | 9 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("cr") && args.length == 1 || cmd.getName().equalsIgnoreCase("cr") && args.length == 2) {
player = (Player) sender; // Sets the player to the Sender
arg1 = args[0];
if(arg1 == "join"){ ... |
51cd54d2-9bb5-42b8-8283-8f4fdd729148 | 8 | protected static int partition(Instances insts, int[] index, int attidx, int l, int r) {
double pivot = insts.instance(index[(l + r) / 2]).value(attidx);
int help;
while (l < r) {
while ((insts.instance(index[l]).value(attidx) < pivot) && (l < r)) {
l++;
}
while ((insts.insta... |
d22de75f-3c14-4481-814d-1eb7ae5be07a | 7 | private void stopShift(Player player, CommandSender sender, boolean isPlayer, String[] split) {
if (isPlayer && checkStop(player) || !isPlayer) {
if (split.length == 1) {// act on player's world
if (isPlayer) {// player world stop
String wname = player.getWorld().getName();
instance.cancelShift(TimeS... |
41c5ad74-8d2b-4b5f-aa01-cb0c145f44db | 3 | public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
} |
5640f873-09db-4a97-ba1e-ff4b40af9738 | 4 | protected void buildIndexMap()
{
//iterate over the names of fields with indices
Set<String> keys = indices.keySet();
for(String field:keys)
{
List<String>indiceList = indices.get(field);
if(indiceList!=null)
{
for(String ind:indiceList)
{
//add field to the list of fields indexed by inde... |
142702b5-6c5f-45db-834a-b980c2390eb4 | 8 | public PersonDetail getUserBasicProfile(String accessToken) throws OAuthError {
String basicInfoUrl = Constants.FB_BASIC_INFO_URI;
PersonDetail personDetail = new PersonDetail();
try {
String charset = "UTF-8";
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePa... |
9ecf336b-c40b-41bb-a524-600a7473c5e1 | 2 | protected void hypothesizeLambda(GrammarEnvironment env, Grammar g) {
LambdaProductionRemover remover = new LambdaProductionRemover();
Set lambdaDerivers = remover.getCompleteLambdaSet(g);
if (lambdaDerivers.contains(g.getStartVariable())) {
JOptionPane.showMessageDialog(env,
"WARNING : The start variable... |
f1a05890-31a9-4680-a3bd-78be9aca01fb | 2 | public List<T> concat(List<T> s)
{ List<T> res=this;
if(s==null)
{ return res;
}
else
{ if(s.next==null)
{ return res.append(s.a);}
else//s.next!=null
{ return res.append(s.a).concat(s.next);}
}
} |
6fee0546-c2f6-4d10-85ad-435f3e28e0f8 | 8 | public static boolean isPrimeWeb(BigInteger n) {
System.out.println("n: "+ n);
if(n.compareTo(BigInteger.valueOf(2L)) == -1) return false;
if(n.compareTo(BigInteger.valueOf(2L)) == 0 || n.compareTo(BigInteger.valueOf(3L)) == 0) return true;
if(n.mod(BigInteger.valueOf(2L)).compareTo(BigInteger.ZERO) == 0 || n.m... |
36bd2866-f304-4add-9a88-8addf178eb17 | 7 | public int[] getInts(int par1, int par2, int par3, int par4)
{
int var5 = par1 - 1;
int var6 = par2 - 1;
int var7 = par3 + 2;
int var8 = par4 + 2;
int[] var9 = this.parent.getInts(var5, var6, var7, var8);
int[] var10 = IntCache.getIntCache(par3 * par4);
for (... |
b770b753-d2a5-4e68-9fa8-67e6ca3f4acb | 0 | private void initSplitPane(){
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeView, tableView);
splitPane.setDividerLocation(WINDOW_SIZE.width/3);
splitPane.setDividerSize(5);
splitPane.setSize(WINDOW_SIZE.width-20, WINDOW_SIZE.height-75);
splitPane.setLocation(5,45)... |
d2331bc5-8fa6-4a20-966c-45395c7eea9c | 2 | public VariableStack mapStackToLocal(VariableStack stack) {
VariableStack newStack;
int params = instr.getFreeOperandCount();
if (params > 0) {
this.stack = stack.peek(params);
newStack = stack.pop(params);
} else
newStack = stack;
trueBlock.jump.stackMap = newStack;
if (jump != null) {
jump.st... |
87a11a42-1ab7-4178-98b0-256d8ccd94fc | 9 | public boolean generatePRGHexDump(Component parentComponent){
if(_numPrgBanks == 0){
System.err.println("Nothing to Dump");
return false;
}
if(_prgBanks.length != _numPrgBanks || _chrBanks.length != _numChrBanks){
System.err.println("Bank size misma... |
8bf448bf-a5ad-4f3a-8c22-4e885065707b | 0 | @Override
public void actionPerformed(ActionEvent e) {
dehoist_all((OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched());
} |
319c3765-d77d-491c-9242-14c175d10255 | 0 | @Basic
@Column(name = "CTR_CC_RESPONSABLE")
public long getCtrCcResponsable() {
return ctrCcResponsable;
} |
20383b14-e1b4-4cf7-8909-033e82ea68c7 | 6 | @EventHandler(priority=EventPriority.LOW)
void onInventoryClick(InventoryClickEvent event) {
if (event.getInventory().getTitle().equals(name)) {
event.setCancelled(true);
//should avoid item taken from menu
event.setCurrentItem(null);
int slot = e... |
0c7949ba-85b3-4376-84a0-9ce0b543689a | 1 | public final Instruction getPrevByAddr() {
if (prevByAddr.opcode == opc_impdep1)
return null;
return prevByAddr;
} |
a37eb0b8-3a67-4132-9403-1e7634228ded | 8 | public void nextTurn() {
Player oldTurnHolder = t.getTurnHolder();
Player newTurnHolder = null;
boolean turnHolderFounded = false;
Iterator<Player> i = t.getPlayersList().iterator();
while (i.hasNext()) {
if (oldTurnHolder == i.next()) {
turnHolderFounded = true;
break;
}
}
if (!... |
6b83138f-8a27-4c48-9bb2-fbc70f63d3eb | 6 | public boolean add (E newItem) {
if (root == null) {
root = new Node(newItem);
size++;
return true;
}
Node node = root;
while (true) {
if (newItem.compareTo(node.data) < 0) {
if (node.left == null) {
node.left = new Node(newItem);
size++;
return true;
} else
node = ... |
19f4380f-3f02-4280-a930-9cca7f182da2 | 7 | @SuppressWarnings("deprecation")
public boolean isBlacklistedItem(ItemStack item, String group) {
List<String> blacklist = plugin.getBlacklistedItems(group);
int dataValue = item.getTypeId();
int damageValue = item.getData().getData();
for (String blacklistedItem : blacklist) {
Integer dataValueBlack = n... |
ce1a247f-843a-43fe-9787-4f8e91266241 | 0 | public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Product");
sb.append("{id=").append(id);
sb.append(", name='").append(name);
sb.append(", price=").append(price);
sb.append(", description='").append(description);
sb.append(", code='").append(code);
sb.append("}\n");
... |
d23a5277-c657-4321-a862-809213adf527 | 5 | public double[][] genMap(){
initMap();
double var = maxHeight; // max random variation
int side = size;// the side of the smallest square with all four points generated
while (side >1){
int xNr;
int yNr;
for (xNr=0;xNr<size;xNr+=side) // diamond step
for(yNr=0;yNr<size;yNr+=side)
makeDiamond(x... |
4273ebce-6e0d-46f1-a32d-c05bea421af0 | 7 | private ArrayList<ArrayList<Integer>> createGen() {
ArrayList<ArrayList<Integer>> nextGen = new ArrayList<ArrayList<Integer>>();
double fitSum = getFitSum();
for (int i = 0; i < currGen.size(); i++) {
nextGen.add(new ArrayList<Integer>());
int parentOne = getIndividual(f... |
148e2444-b444-4c15-a831-6a0c5252f201 | 0 | public long[] getInitTemps() {
return this.initialTemps;
} |
9ad614b0-1d4d-47bc-bc0a-4c7eed605132 | 4 | private void tryAdd(String rawLine, List<Word> data, int linenum) {
if (rawLine == null) {
return;
}
String line = rawLine.trim();
if (line.length() < prefix.length()) {
return;
}
if (!line.startsWith(prefix)) {
return;
}
... |
8aebfb72-d8c2-46ce-b33f-923704548fce | 0 | @Override
public void setName(String name) {
super.setName(name);
} |
7ae5fe29-02cb-4fed-a66a-ac6554cd9421 | 9 | public static Map<Integer,ComparableGrid2D<Double>> create(final ComparableGrid2D<Double> heightmap, final ComparableGrid2D<Double> soilmap, final ForestAttributes attributes)
{
final Map<Integer,ComparableGrid2D<Double>> result = new HashMap<Integer,ComparableGrid2D<Double>>();
final Random rand = new Random(attr... |
92b755cc-637b-4394-b17a-27175a14b918 | 9 | public static void main(String[] args) {
try {
BufferedReader in = new BufferedReader(new FileReader(args[0]));
String s, s2 = new String();
while ((s = in.readLine()) != null) {
s2 += s + "\n";
}
in.close();
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.... |
a46a12fc-75b9-409e-bf94-6f35ff8551ea | 9 | private boolean r_Step_4() {
int among_var;
int v_1;
// (, line 140
// [, line 141
ket = cursor;
// substring, line 141
among_var = find_among_b(a_7, 18);
if (among_var == 0)
... |
1b6aa3ea-be4b-4a61-8e7f-fef43d85acd5 | 8 | public static String createIndex(File dir, String path) throws IOException {
if (!path.endsWith("/"))
path += "/";
// calculate name column width
int w = 21; // minimum width
for (String name : dir.list())
if (name.length() > w)
w = name.length();
... |
25e59174-2fbf-4de3-b17c-29540a34a202 | 2 | private boolean jj_3_45() {
if (jj_3R_65()) return true;
if (jj_3R_66()) return true;
return false;
} |
ec7bc65c-e5df-42e0-a9e9-c001124d3cc4 | 0 | public String toString(){
return "times ";
} |
2f31915a-0fed-4de0-a90c-aae02f05fadb | 9 | private final void addSiblingFeatures(DependencyInstance instance,
int ch1, int ch2,
boolean isST,
FeatureVector fv) {
String[] forms = instance.forms;
String[] pos = instance.postags;
// ch1 is always the closes to par
String dir = ch1 > ch2 ? "RA" : "LA";
String ch1_pos = isST ? "STPO... |
d70829a9-67eb-49ca-b3c0-40035886846d | 8 | public static Point[] getBlastRadius(Point point, int blockSize, int radius) {
if(radius == 0) {
return new Point[] {new Point(point.x, point.y + blockSize)};
} else if(radius == 1) {
return new Point[] {new Point(point.x, point.y - blockSize),
new Point(point.x - blockSize, point.y),
new Point(poin... |
82b091c8-b87b-4d72-b1bb-2b14a8ff9a3a | 2 | @Override
protected void onPostExecute(byte[] result) {
if (super.getSignatureListener() == null) {
return;
}
if (result != null) {
super.file.setSignature(result);
super.file.setLastSignedDate(new Date());
StringBuilder str = new StringBuild... |
aaee297f-5a2b-46ca-bc3a-57bcf104a06c | 4 | @SuppressWarnings("static-access")
public double kinship(Individual other) {
if(!(other instanceof DoubleValue)) return 0;
DoubleFunction f = ((DoubleFunction)fitness);
if(other.fitness != f) return 0;
if(other==this)return 1;
double[] cousinFen = ((DoubleValue) other).fenotypes();
double[] myFen ... |
44d95e96-1ec2-4ee6-92ab-9995e3d0b630 | 8 | public static int getLevenshteinDistance(String s, String t) {
if (s == null || t == null) {
throw new IllegalArgumentException("Strings must not be null");
}
/*
* The difference between this impl. and the previous is that, rather
* than creating and retaining a ma... |
3c1d198e-3748-41a9-8d6f-2cdafb6e0d61 | 1 | public void removePush() {
if (pushedLocal != null)
exceptionLocal = pushedLocal;
super.removePush();
} |
44f8821b-d3a6-4621-91c0-f5d095360075 | 0 | private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
stream.writeObject(name);
stream.writeObject(state.toString());
stream.writeObject(exception);
} |
68945665-78ea-43d6-9b1d-ed9c763594a9 | 7 | @Override
protected void onNickChange(final String oldNick, final String login,
final String hostname, final String newNick) {
if (awaitingNickChange && loggingIn
&& oldNick.equalsIgnoreCase(this.oldNick)
&& newNick.equalsIgnoreCase(loginNick)) {
awaitingNickChange = loggingIn = false;
setVerbose(fa... |
d08e5bb6-2be0-4907-b56c-dbc731720e08 | 4 | public void contextDestroyed(ServletContextEvent sce) {
/* stop JPA/hibernate */
EntityManagerFactory factory = (EntityManagerFactory) sce.getServletContext().getAttribute(EntityManagerFactory.class.getName());
if(factory != null) {
try {
factory.close();
sce.getServletContext().removeAttribute(EntityM... |
b03ca42b-81a8-401a-b04e-9e1c51a3e4e1 | 3 | public Register[] family() {
for (int i = 0; i != ALL_FAMILIES.length; ++i) {
Register[] candidate = ALL_FAMILIES[i];
for (int j = 0; j != candidate.length; ++j) {
if (candidate[j] == this) {
return candidate;
}
}
}
throw new IllegalArgumentException("Register does not have family?");
} |
e6a4a8b3-d9a7-4c78-8095-a772180c58c4 | 5 | @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 Payment)) {
return false;
}
Payment other = (Payment) object;
if ((this.id == null && other.id != null) || (thi... |
166ceac1-4196-47e3-861f-59d3bc997960 | 2 | public void tickDownStatuses(int currentPlayerIndex) {
// Tick down all statuses caused by the player who is starting their turn.
for (Status status : statuses) {
status.tickDown(currentPlayerIndex);
if (status.getRemainingDuration() <= 0) {
statuses.remove(status);
}
}
} |
fadb0e12-9a4a-4b33-abe9-88929bf53f5c | 9 | @Override
public int compareTo(Data data) {
if (this.getDia() == 0 && this.getMes() == 0 && this.getAno() == 0) {
return 2;
}
if (data.getAno() > this.getAno()) {
return -1;
} else if (data.getAno() < this.getAno()) {
return 1;
} else {
if (data.getMes() > this.getMes()) {
return -1;
} els... |
1be39500-cfa5-4a36-bdf5-ff3e8a2fa94e | 4 | @Override
public void tick(double deltaT) {
if (x < r || x > areaWidth - r) {
vx *= -1;
}
if (y < r || y > areaHeight - r) {
vy *= -1;
}
x += vx * deltaT;
y += vy * deltaT;
} |
b1289d89-fbe6-48df-a719-27e56db20e2b | 4 | private int findEndOfAttributeWord(String string)
{
// for_each {character} in {string} do check()
for(int i = 0; i < string.length(); i++)
{
char c = string.charAt(i);
if(c == ' ')
{
return i;
}
if((i > 0) && (c == '='))
{
return i;
}
}
return string... |
30c6c738-ca8e-4649-972d-21fad000eae1 | 7 | public String ValidarCampo(ComprobanteCompra BEEntidades)
{
Result rs = new Result();
StringBuilder sb = new StringBuilder();
//sb.append(Common.IsNullOrEmpty(BEEntidades.getConcepto())? "nombre inválido,": "");
sb.append(Common.IsMinorOrEqualsZero(BEEntidades.getMoneda())? "Moneda i... |
08a47d09-0b6c-4c93-b968-43888a929d14 | 7 | public static Surrogate lookupSlotref(Surrogate self, Symbol slotname) {
self = ((Surrogate)(Surrogate.realTypeSpecifier(self)));
{ Stella_Class renamed_Class = ((Stella_Class)(self.surrogateValue));
Slot slot = null;
Surrogate slotref = null;
slot = Symbol.lookupFunction(slotname);
if ... |
c93af26a-48b9-438c-aa79-12a0a8e3d32c | 6 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.