code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public void vertex(float[] v){
g.vertex(v);
}
| Used by renderer subclasses or PShape to efficiently pass in already formatted vertex information. |
@Override public boolean equals(Object other){
if (_map.equals(other)) {
return true;
}
else if (other instanceof Map) {
Map that=(Map)other;
if (that.size() != _map.size()) {
return false;
}
else {
Iterator it=that.entrySet().iterator();
for (int i=that.size(); i-- > 0; ) {
Map.Entry e=(Map.Entry)it.next();
Object key=e.getKey();
Object val=e.getValue();
if (key instanceof Float && val instanceof Float) {
float k=unwrapKey(key);
float v=unwrapValue(val);
if (_map.containsKey(k) && v == _map.get(k)) {
}
else {
return false;
}
}
else {
return false;
}
}
return true;
}
}
else {
return false;
}
}
| Compares this map with another map for equality of their stored entries. |
public boolean isActivated(){
return (sActivationFlag == TRACE_ON);
}
| Is logger activated |
@SuppressWarnings({"rawtypes","unchecked"}) @Test public void testNodeProcessing() throws Exception {
MostFrequentValue<String> oper=new MostFrequentValue<String>();
CountAndLastTupleTestSink matchSink=new CountAndLastTupleTestSink();
CountAndLastTupleTestSink listSink=new CountAndLastTupleTestSink();
oper.most.setSink(matchSink);
oper.list.setSink(listSink);
oper.beginWindow(0);
int atot=5;
int btot=7;
int ctot=6;
for (int i=0; i < atot; i++) {
oper.data.process("a");
}
for (int i=0; i < btot; i++) {
oper.data.process("b");
}
for (int i=0; i < ctot; i++) {
oper.data.process("c");
}
oper.endWindow();
Assert.assertEquals("number emitted tuples",1,matchSink.count);
HashMap<String,Integer> tuple=(HashMap<String,Integer>)matchSink.tuple;
Integer val=tuple.get("b");
Assert.assertEquals("Count of b was ",btot,val.intValue());
Assert.assertEquals("number emitted tuples",1,listSink.count);
ArrayList<HashMap<String,Integer>> list=(ArrayList<HashMap<String,Integer>>)listSink.tuple;
val=list.get(0).get("b");
Assert.assertEquals("Count of b was ",btot,val.intValue());
matchSink.clear();
listSink.clear();
oper.beginWindow(0);
atot=5;
btot=4;
ctot=5;
for (int i=0; i < atot; i++) {
oper.data.process("a");
}
for (int i=0; i < btot; i++) {
oper.data.process("b");
}
for (int i=0; i < ctot; i++) {
oper.data.process("c");
}
oper.endWindow();
Assert.assertEquals("number emitted tuples",1,matchSink.count);
Assert.assertEquals("number emitted tuples",1,listSink.count);
list=(ArrayList<HashMap<String,Integer>>)listSink.tuple;
int acount=0;
int ccount=0;
for ( HashMap<String,Integer> h : list) {
val=h.get("a");
if (val == null) {
ccount=h.get("c");
}
else {
acount=val;
}
}
Assert.assertEquals("Count of a was ",atot,acount);
Assert.assertEquals("Count of c was ",ctot,ccount);
HashMap<String,Integer> mtuple=(HashMap<String,Integer>)matchSink.tuple;
val=mtuple.get("a");
if (val == null) {
val=mtuple.get("c");
}
Assert.assertEquals("Count of least frequent key was ",ctot,val.intValue());
}
| Test node logic emits correct results |
public void assertArrayEqual(byte[] expected,byte[] actual){
TestUtils.assertArrayEqual(expected,actual);
}
| This method just invokes the test utils method, it is here for convenience |
public void addCoalescingKey(long downTime){
mDownTimeToCoalescingKey.put((int)downTime,0);
}
| Starts tracking a new coalescing key corresponding to the gesture with this down time. |
private static Register isCandidateExpression(Instruction s,boolean ssa){
switch (s.getOpcode()) {
case BOOLEAN_NOT_opcode:
case INT_NOT_opcode:
case REF_NOT_opcode:
case LONG_NOT_opcode:
case INT_NEG_opcode:
case REF_NEG_opcode:
case LONG_NEG_opcode:
case FLOAT_NEG_opcode:
case DOUBLE_NEG_opcode:
case INT_2BYTE_opcode:
case INT_2SHORT_opcode:
case INT_2USHORT_opcode:
case INT_2LONG_opcode:
case LONG_2INT_opcode:
case FLOAT_2DOUBLE_opcode:
case DOUBLE_2FLOAT_opcode:
{
Operand val1=Unary.getVal(s);
if (val1.isConstant()) {
return null;
}
Register result=Unary.getResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val1.asRegister().getRegister() != result) {
return result;
}
else {
return null;
}
}
case ARRAYLENGTH_opcode:
{
Operand val1=GuardedUnary.getVal(s);
if (val1.isConstant()) {
return null;
}
Register result=GuardedUnary.getResult(s).asRegister().getRegister();
return result;
}
case INT_ADD_opcode:
case REF_ADD_opcode:
case LONG_ADD_opcode:
case FLOAT_ADD_opcode:
case DOUBLE_ADD_opcode:
case INT_SUB_opcode:
case REF_SUB_opcode:
case LONG_SUB_opcode:
case FLOAT_SUB_opcode:
case DOUBLE_SUB_opcode:
case INT_MUL_opcode:
case LONG_MUL_opcode:
case FLOAT_MUL_opcode:
case DOUBLE_MUL_opcode:
case FLOAT_DIV_opcode:
case DOUBLE_DIV_opcode:
case INT_SHL_opcode:
case REF_SHL_opcode:
case LONG_SHL_opcode:
case INT_SHR_opcode:
case REF_SHR_opcode:
case LONG_SHR_opcode:
case INT_USHR_opcode:
case REF_USHR_opcode:
case LONG_USHR_opcode:
case INT_AND_opcode:
case REF_AND_opcode:
case LONG_AND_opcode:
case INT_OR_opcode:
case REF_OR_opcode:
case LONG_OR_opcode:
case INT_XOR_opcode:
case REF_XOR_opcode:
case LONG_XOR_opcode:
case LONG_CMP_opcode:
case FLOAT_CMPL_opcode:
case DOUBLE_CMPL_opcode:
case FLOAT_CMPG_opcode:
case DOUBLE_CMPG_opcode:
{
Operand val2=Binary.getVal2(s);
if (!val2.isObjectConstant() && !val2.isTIBConstant()) {
if (val2.isConstant()) {
Operand val1=Binary.getVal1(s);
if (val1.isConstant()) {
return null;
}
Register result=Binary.getResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val1.asRegister().getRegister() != result) {
return result;
}
else {
return null;
}
}
else {
if (VM.VerifyAssertions) {
VM._assert(val2.isRegister());
}
Operand val1=Binary.getVal1(s);
if (s.operator().isCommutative() && val1.isConstant() && !val1.isMovableObjectConstant()&& !val1.isTIBConstant()) {
Binary.setVal1(s,Binary.getClearVal2(s));
Binary.setVal2(s,val1);
Register result=Binary.getResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val2.asRegister().getRegister() != result) {
return result;
}
else {
return null;
}
}
}
}
return null;
}
case INT_DIV_opcode:
case LONG_DIV_opcode:
{
Operand val2=GuardedBinary.getVal2(s);
if (val2.isConstant()) {
Operand val1=GuardedBinary.getVal1(s);
if (val1.isConstant()) {
return null;
}
Register result=GuardedBinary.getResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val1.asRegister().getRegister() != result) {
return result;
}
}
return null;
}
case BOOLEAN_CMP_INT_opcode:
case BOOLEAN_CMP_LONG_opcode:
case BOOLEAN_CMP_ADDR_opcode:
{
Operand val2=BooleanCmp.getVal2(s);
if (val2.isConstant() && !val2.isMovableObjectConstant() && !val2.isTIBConstant()) {
Operand val1=BooleanCmp.getVal1(s);
if (val1.isConstant()) {
return null;
}
Register result=BooleanCmp.getResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val1.asRegister().getRegister() != result) {
return result;
}
}
else if (val2.isRegister()) {
Operand val1=BooleanCmp.getVal1(s);
if (val1.isConstant() && !val1.isMovableObjectConstant() && !val1.isTIBConstant()) {
BooleanCmp.setVal1(s,BooleanCmp.getClearVal2(s));
BooleanCmp.setVal2(s,val1);
BooleanCmp.getCond(s).flipOperands();
Register result=BooleanCmp.getResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val2.asRegister().getRegister() != result) {
return result;
}
}
}
return null;
}
case INT_IFCMP_opcode:
case LONG_IFCMP_opcode:
case FLOAT_IFCMP_opcode:
case DOUBLE_IFCMP_opcode:
case REF_IFCMP_opcode:
{
Operand val2=IfCmp.getVal2(s);
if (!val2.isObjectConstant() && !val2.isTIBConstant()) {
if (val2.isConstant()) {
Operand val1=IfCmp.getVal1(s);
if (val1.isConstant()) {
return null;
}
Register result=IfCmp.getGuardResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val1.asRegister().getRegister() != result) {
return result;
}
}
else {
if (VM.VerifyAssertions) {
VM._assert(val2.isRegister());
}
Operand val1=IfCmp.getVal1(s);
if (val1.isConstant() && !val1.isMovableObjectConstant() && !val1.isTIBConstant()) {
IfCmp.setVal1(s,IfCmp.getClearVal2(s));
IfCmp.setVal2(s,val1);
IfCmp.getCond(s).flipOperands();
Register result=IfCmp.getGuardResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val2.asRegister().getRegister() != result) {
return result;
}
}
}
}
return null;
}
case INT_IFCMP2_opcode:
{
Operand val2=IfCmp2.getVal2(s);
if (!val2.isObjectConstant() && !val2.isTIBConstant()) {
if (val2.isConstant()) {
Operand val1=IfCmp2.getVal1(s);
if (val1.isConstant()) {
return null;
}
Register result=IfCmp2.getGuardResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val1.asRegister().getRegister() != result) {
return result;
}
}
else {
if (VM.VerifyAssertions) {
VM._assert(val2.isRegister());
}
Operand val1=IfCmp2.getVal1(s);
if (val1.isConstant() && !val1.isMovableObjectConstant() && !val1.isTIBConstant()) {
IfCmp2.setVal1(s,IfCmp2.getClearVal2(s));
IfCmp2.setVal2(s,val1);
IfCmp2.getCond1(s).flipOperands();
IfCmp2.getCond2(s).flipOperands();
Register result=IfCmp2.getGuardResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val2.asRegister().getRegister() != result) {
return result;
}
}
}
}
return null;
}
case INT_COND_MOVE_opcode:
case LONG_COND_MOVE_opcode:
case REF_COND_MOVE_opcode:
case FLOAT_COND_MOVE_opcode:
case DOUBLE_COND_MOVE_opcode:
case GUARD_COND_MOVE_opcode:
{
Operand val2=CondMove.getVal2(s);
if (!val2.isObjectConstant()) {
if (val2.isConstant()) {
Operand val1=CondMove.getVal1(s);
if (val1.isConstant()) {
return null;
}
Register result=CondMove.getResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val1.asRegister().getRegister() != result) {
return result;
}
}
else {
if (VM.VerifyAssertions) {
VM._assert(val2.isRegister());
}
Operand val1=CondMove.getVal1(s);
if (val1.isConstant() && !val1.isMovableObjectConstant()) {
CondMove.setVal1(s,CondMove.getClearVal2(s));
CondMove.setVal2(s,val1);
CondMove.getCond(s).flipOperands();
Register result=CondMove.getResult(s).asRegister().getRegister();
if (ssa) {
return result;
}
else if (val2.asRegister().getRegister() != result) {
return result;
}
}
}
}
return null;
}
case BOUNDS_CHECK_opcode:
{
Operand ref=BoundsCheck.getRef(s);
Operand index=BoundsCheck.getIndex(s);
if (index.isConstant()) {
if (ref.isConstant()) {
return null;
}
return BoundsCheck.getGuardResult(s).asRegister().getRegister();
}
return null;
}
case NULL_CHECK_opcode:
{
Operand ref=NullCheck.getRef(s);
if (ref.isConstant()) {
return null;
}
return NullCheck.getGuardResult(s).asRegister().getRegister();
}
case INSTANCEOF_opcode:
{
Operand ref=InstanceOf.getRef(s);
if (ref.isConstant()) {
return null;
}
return InstanceOf.getResult(s).getRegister();
}
case NEWARRAY_opcode:
{
Operand size=NewArray.getSize(s);
if (size.isConstant()) {
return NewArray.getResult(s).getRegister();
}
return null;
}
case NEW_opcode:
{
return New.getResult(s).getRegister();
}
case INT_ZERO_CHECK_opcode:
case LONG_ZERO_CHECK_opcode:
{
Operand val1=ZeroCheck.getValue(s);
if (val1.isConstant()) {
return null;
}
return ZeroCheck.getGuardResult(s).asRegister().getRegister();
}
default :
return null;
}
}
| Does instruction s compute a register r = candidate expression? |
private void computeRotationTime(){
_keyRotationIntervalInMsecs=_maxLifeValuesHolder.computeRotationTimeInMSecs();
_log.info("Key rotation time in msecs: {}",_keyRotationIntervalInMsecs);
}
| initializes the rotation time based on the max token life value. |
public static int truncatedCompareTo(final Calendar cal1,final Calendar cal2,final int field){
final Calendar truncatedCal1=truncate(cal1,field);
final Calendar truncatedCal2=truncate(cal2,field);
return truncatedCal1.compareTo(truncatedCal2);
}
| Determines how two calendars compare up to no more than the specified most significant field. |
public static void warn(final String message){
if (JQuantLib.logger != null) {
JQuantLib.logger.warn(message);
}
else {
System.err.printf("WARN: %s\n",message);
}
}
| This method unconditionally emits a message to the logging system but does not throw any exception. |
public JSONEditor(IBurpExtenderCallbacks callbacks){
this.callbacks=callbacks;
this.helpers=callbacks.getHelpers();
}
| JSON Editor. Create a new JSONEditor factory. |
@PostConstruct public void init(){
super.init("label.configuration.auth.gatewaytoken");
configurationEnabled=isConfigEnabled();
detailLayout=new VerticalLayout();
detailLayout.setImmediate(true);
gatewayTokenNameTextField=new TextFieldBuilder().immediate(true).buildTextComponent();
gatewayTokenNameTextField.setVisible(false);
gatewayTokenNameTextField.addTextChangeListener(null);
final Button gatewaytokenBtn=SPUIComponentProvider.getButton("TODO-ID","Regenerate Key","",ValoTheme.BUTTON_TINY + " " + "redicon",true,null,SPUIButtonStyleSmall.class);
gatewaytokenBtn.setImmediate(true);
gatewaytokenBtn.setIcon(FontAwesome.REFRESH);
gatewaytokenBtn.addClickListener(null);
gatewayTokenkeyLabel=new LabelBuilder().id("gatewaysecuritytokenkey").name("").buildLabel();
gatewayTokenkeyLabel.addStyleName("gateway-token-label");
gatewayTokenkeyLabel.setImmediate(true);
final HorizontalLayout keyGenerationLayout=new HorizontalLayout();
keyGenerationLayout.setSpacing(true);
keyGenerationLayout.setImmediate(true);
keyGenerationLayout.addComponent(gatewayTokenNameTextField);
keyGenerationLayout.addComponent(gatewayTokenkeyLabel);
keyGenerationLayout.addComponent(gatewaytokenBtn);
detailLayout.addComponent(keyGenerationLayout);
if (isConfigEnabled()) {
gatewayTokenNameTextField.setValue(getSecurityTokenName());
gatewayTokenkeyLabel.setValue(getSecurityTokenKey());
setDetailVisible(true);
}
}
| Init mehotd called by spring. |
public static void resetSecuritySystemProperties(){
System.clearProperty("javax.net.ssl.keyStore");
System.clearProperty("javax.net.ssl.keyStorePassword");
System.clearProperty("javax.net.ssl.trustStore");
System.clearProperty("javax.net.ssl.trustStorePassword");
System.clearProperty("javax.rmi.ssl.client.enabledCipherSuites");
System.clearProperty(SecurityConf.SYSTEM_PROP_CLIENT_SSLPROTOCOLS);
System.clearProperty(SecurityConf.SYSTEM_PROP_CLIENT_SSLCIPHERS);
System.clearProperty("https.protocols");
}
| Reset system properties to null value |
private CProjectTreeNodeHelpers(){
}
| You are not supposed to instantiate this class. |
public static <V extends Vec>Vec meanVector(List<V> dataSet){
if (dataSet.isEmpty()) throw new ArithmeticException("Can not compute the mean of zero data points");
Vec mean=new DenseVector(dataSet.get(0).length());
meanVector(mean,dataSet);
return mean;
}
| Computes the mean of the given data set. |
public static void installAllAppEngineRuntimes(IFacetedProject project,boolean force,IProgressMonitor monitor) throws CoreException {
Set<IRuntime> existingTargetedRuntimes=project.getTargetedRuntimes();
if (!existingTargetedRuntimes.isEmpty()) {
for ( IRuntime existingTargetedRuntime : existingTargetedRuntimes) {
if (AppEngineStandardFacet.isAppEngineStandardRuntime(existingTargetedRuntime) && !force) {
return;
}
}
}
org.eclipse.wst.server.core.IRuntime[] appEngineRuntimes=getAppEngineRuntimes();
if (appEngineRuntimes.length > 0) {
IRuntime appEngineFacetRuntime=null;
for (int index=0; index < appEngineRuntimes.length; index++) {
appEngineFacetRuntime=FacetUtil.getRuntime(appEngineRuntimes[index]);
project.addTargetedRuntime(appEngineFacetRuntime,monitor);
}
project.setPrimaryRuntime(appEngineFacetRuntime,monitor);
}
else {
IRuntime appEngineFacetRuntime=createAppEngineFacetRuntime(monitor);
if (appEngineFacetRuntime == null) {
throw new NullPointerException("Could not locate App Engine facet runtime");
}
project.addTargetedRuntime(appEngineFacetRuntime,monitor);
project.setPrimaryRuntime(appEngineFacetRuntime,monitor);
}
}
| If App Engine runtimes exist in the workspace, add them to the list of targeted runtimes of <code>project</code>. Otherwise create a new App Engine runtime and add it to the list of targeted runtimes. |
@Override public void onGeolocationPermissionsShowPrompt(String origin,Callback callback){
super.onGeolocationPermissionsShowPrompt(origin,callback);
callback.invoke(origin,true,false);
}
| Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin. |
public void testEncodeV4(){
byte[] expectedReturn=msgFixture.requestedAddressFamilyV4;
requestedAddressFamilyAttribute.setFamily(MsgFixture.REQUESTED_ADDRESS_FAMILY_ATTRIBUTE_V4);
byte[] actualReturn=requestedAddressFamilyAttribute.encode();
assertTrue("RequestedAddressFamilyAttribute.encode() did not " + "properly encode a sample attribute for IPv4 family",Arrays.equals(expectedReturn,actualReturn));
}
| Test whether attributes are properly encoded. |
public synchronized boolean remove(final CacheKey key,final EncodedImage encodedImage){
Preconditions.checkNotNull(key);
Preconditions.checkNotNull(encodedImage);
Preconditions.checkArgument(EncodedImage.isValid(encodedImage));
final EncodedImage oldValue=mMap.get(key);
if (oldValue == null) {
return false;
}
CloseableReference<PooledByteBuffer> oldRef=oldValue.getByteBufferRef();
CloseableReference<PooledByteBuffer> ref=encodedImage.getByteBufferRef();
try {
if (oldRef == null || ref == null || oldRef.get() != ref.get()) {
return false;
}
mMap.remove(key);
}
finally {
CloseableReference.closeSafely(ref);
CloseableReference.closeSafely(oldRef);
EncodedImage.closeSafely(oldValue);
}
logStats();
return true;
}
| Removes key-value from the StagingArea. Both key and value must match. |
private double convertFromPanelY(double pY){
pY=m_panelHeight - pY;
pY/=m_panelHeight;
pY*=m_rangeY;
return pY + m_minY;
}
| Convert a Y coordinate from the panel space to the instance space. |
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix,namespace);
xmlWriter.setPrefix(prefix,namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
}
| Util method to write an attribute with the ns prefix |
public static void main(String[] args) throws IOException {
Action action=null;
int index=-1;
String entryString=null;
if (args.length < 1 || args[0].equals("-help") || args[0].equals("-?")) usage();
if (args.length == 1) {
action=Action.PRINT;
}
else {
String s=args[0];
if (Pattern.matches("^A[0-9]*\\+.*",s)) {
String[] result=s.split("\\+",2);
if (result.length == 2) {
if (result[0].length() < 2) {
index=0;
}
else {
index=Integer.parseInt(result[0].substring(1));
}
entryString=result[1];
action=Action.ADD;
}
}
if (Pattern.matches("^A[0-9]+\\-",s)) {
String[] result=s.split("\\-",2);
if (result.length == 2) {
index=Integer.parseInt(result[0].substring(1));
entryString=result[1];
action=Action.REMOVE;
}
}
if (Pattern.matches("^A[0-9]+=.*",s)) {
String[] result=s.split("=",2);
if (result.length == 2) {
index=Integer.parseInt(result[0].substring(1));
entryString=result[1];
action=Action.REPLACE;
}
}
}
if (action == null) usage();
int fileArg=(action == Action.PRINT) ? 0 : 1;
Path file=Paths.get(args[fileArg]);
AclFileAttributeView view=Files.getFileAttributeView(file,AclFileAttributeView.class);
if (view == null) {
System.err.println("ACLs not supported on this platform");
System.exit(-1);
}
List<AclEntry> acl=view.getAcl();
switch (action) {
case PRINT:
{
for (int i=0; i < acl.size(); i++) {
System.out.format("%5d: %s\n",i,acl.get(i));
}
break;
}
case ADD:
{
AclEntry entry=parseAceString(entryString,file.getFileSystem().getUserPrincipalLookupService());
if (index >= acl.size()) {
acl.add(entry);
}
else {
acl.add(index,entry);
}
view.setAcl(acl);
break;
}
case REMOVE:
{
if (index >= acl.size()) {
System.err.format("Index '%d' is invalid",index);
System.exit(-1);
}
acl.remove(index);
view.setAcl(acl);
break;
}
case REPLACE:
{
if (index >= acl.size()) {
System.err.format("Index '%d' is invalid",index);
System.exit(-1);
}
AclEntry entry=parseAceString(entryString,file.getFileSystem().getUserPrincipalLookupService());
acl.set(index,entry);
view.setAcl(acl);
break;
}
}
}
| Main class: parses arguments and prints or edits ACL |
private void userSelected(MouseEvent e){
User user=getUser(e);
if (user != null) {
userListener.userClicked(user,e);
}
}
| Called when a user is double-clicked to tell the GUI to perform the User-selected action (open the User Info dialog). |
public DBException(String msg){
super(msg);
}
| Create a new DBException |
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException {
String prefix;
String namespace;
String methName;
String fullName=m_arg0.execute(xctxt).str();
int indexOfNSSep=fullName.indexOf(':');
if (indexOfNSSep < 0) {
prefix="";
namespace=Constants.S_XSLNAMESPACEURL;
methName=fullName;
}
else {
prefix=fullName.substring(0,indexOfNSSep);
namespace=xctxt.getNamespaceContext().getNamespaceForPrefix(prefix);
if (null == namespace) return XBoolean.S_FALSE;
methName=fullName.substring(indexOfNSSep + 1);
}
if (namespace.equals(Constants.S_XSLNAMESPACEURL)) {
try {
if (null == m_functionTable) m_functionTable=new FunctionTable();
return m_functionTable.functionAvailable(methName) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
catch ( Exception e) {
return XBoolean.S_FALSE;
}
}
else {
ExtensionsProvider extProvider=(ExtensionsProvider)xctxt.getOwnerObject();
return extProvider.functionAvailable(namespace,methName) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
}
| Execute the function. The function must return a valid object. |
public LdapUserToken(Authentication auth,GrantedAuthority defaultAuthority){
this.auth=auth;
if (auth.getAuthorities() != null) {
this.authorities.addAll(Arrays.asList(auth.getAuthorities()));
}
if (defaultAuthority != null) {
this.authorities.add(defaultAuthority);
}
super.setAuthenticated(true);
}
| Construct a new LdapAuthenticationToken, using an existing Authentication object and granting all users a default authority. |
@Override public boolean pressKeyCode(int keyCode,int metaState){
return device.pressKeyCode(keyCode,metaState);
}
| Simulates a short press using a key code. See KeyEvent. |
private static boolean isAssignable(final Type type,final WildcardType toWildcardType,final Map<TypeVariable<?>,Type> typeVarAssigns){
if (type == null) {
return true;
}
if (toWildcardType == null) {
return false;
}
if (toWildcardType.equals(type)) {
return true;
}
final Type[] toUpperBounds=getImplicitUpperBounds(toWildcardType);
final Type[] toLowerBounds=getImplicitLowerBounds(toWildcardType);
if (type instanceof WildcardType) {
final WildcardType wildcardType=(WildcardType)type;
final Type[] upperBounds=getImplicitUpperBounds(wildcardType);
final Type[] lowerBounds=getImplicitLowerBounds(wildcardType);
for ( Type toBound : toUpperBounds) {
toBound=substituteTypeVariables(toBound,typeVarAssigns);
for ( final Type bound : upperBounds) {
if (!isAssignable(bound,toBound,typeVarAssigns)) {
return false;
}
}
}
for ( Type toBound : toLowerBounds) {
toBound=substituteTypeVariables(toBound,typeVarAssigns);
for ( final Type bound : lowerBounds) {
if (!isAssignable(toBound,bound,typeVarAssigns)) {
return false;
}
}
}
return true;
}
for ( final Type toBound : toUpperBounds) {
if (!isAssignable(type,substituteTypeVariables(toBound,typeVarAssigns),typeVarAssigns)) {
return false;
}
}
for ( final Type toBound : toLowerBounds) {
if (!isAssignable(substituteTypeVariables(toBound,typeVarAssigns),type,typeVarAssigns)) {
return false;
}
}
return true;
}
| <p>Checks if the subject type may be implicitly cast to the target wildcard type following the Java generics rules.</p> |
public NbtTagByteArray(String name,byte[] value){
super(name);
Validate.notNull(value,"array can't be null.");
this.value=value;
}
| Construct new NbtTagByteArray with given name and value. |
public int recordSize(int recordNumber){
return (recordCount < recordNumber) ? 0 : offsettable[(recordNumber - 1) * 2 + 1];
}
| get the size of the record in the associated table file If recordNumber is greater than the number of records, this returns a record size of 0. |
private void initDao() throws Exception {
if (!tableExists()) {
createTable();
}
}
| Initialise the DAO by creating the table if it does not exist. |
public final String matchCategories(Set<String> categories){
if (categories == null) {
return null;
}
Iterator<String> it=categories.iterator();
if (mCategories == null) {
return it.hasNext() ? it.next() : null;
}
while (it.hasNext()) {
final String category=it.next();
if (!mCategories.contains(category)) {
return category;
}
}
return null;
}
| Match this filter against an Intent's categories. Each category in the Intent must be specified by the filter; if any are not in the filter, the match fails. |
public void listTraceSessions() throws SQLException {
try (FbService service=attachServiceManager()){
service.startServiceAction(getTraceSPB(service,isc_action_svc_trace_list));
queueService(service);
}
catch ( IOException ioe) {
throw new SQLException(ioe);
}
}
| List all currently registered trace sessions |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:01:54.818 -0500",hash_original_method="DE7905EDF6B0EF2B9BB95373F14A9269",hash_generated_method="1BBDB8944905322C059906793349F99A") public final SecretKey translateKey(SecretKey key) throws InvalidKeyException {
return spiImpl.engineTranslateKey(key);
}
| Translates the specified secret key into an instance of the corresponding key from the provider of this key factory. |
public static int encode(byte[] data,int off,int length,OutputStream out) throws IOException {
return encoder.encode(data,off,length,out);
}
| Hex encode the byte data writing it to the given output stream. |
public boolean isSelected(){
return selected;
}
| Returns whether the text range is selected. |
private String generateLDAPQuery(String username) throws GuacamoleException {
List<String> usernameAttributes=confService.getUsernameAttributes();
StringBuilder ldapQuery=new StringBuilder("(&(objectClass=*)");
if (usernameAttributes.size() > 1) ldapQuery.append("(|");
for ( String usernameAttribute : usernameAttributes) {
ldapQuery.append("(");
ldapQuery.append(escapingService.escapeLDAPSearchFilter(usernameAttribute));
ldapQuery.append("=");
ldapQuery.append(escapingService.escapeLDAPSearchFilter(username));
ldapQuery.append(")");
}
if (usernameAttributes.size() > 1) ldapQuery.append(")");
ldapQuery.append(")");
return ldapQuery.toString();
}
| Generates a properly-escaped LDAP query which finds all objects having at least one username attribute set to the specified username, where the possible username attributes are defined within guacamole.properties. |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public XMLString newstr(char[] string,int start,int length){
return new XStringForChars(string,start,length);
}
| Create a XMLString from a FastStringBuffer. |
public DrawerBuilder withDelayDrawerClickEvent(int delayDrawerClickEvent){
this.mDelayDrawerClickEvent=delayDrawerClickEvent;
return this;
}
| Define the delay for the drawer click event after a click. This can be used to improve performance and prevent lag, especially when you switch fragments inside the listener. This will ignore the boolean value you can return in the listener, as the listener is called after the drawer was closed. NOTE: Disable this to pass -1 |
public MethodHandle findGetter(Class<?> refc,String name,Class<?> type) throws NoSuchFieldException, IllegalAccessException {
MemberName field=resolveOrFail(REF_getField,refc,name,type);
return getDirectField(REF_getField,refc,field);
}
| Produces a method handle giving read access to a non-static field. The type of the method handle will have a return type of the field's value type. The method handle's single argument will be the instance containing the field. Access checking is performed immediately on behalf of the lookup class. |
public void testNextLong(){
SplittableRandom sr=new SplittableRandom();
long f=sr.nextLong();
int i=0;
while (i < NCALLS && sr.nextLong() == f) ++i;
assertTrue(i < NCALLS);
}
| Repeated calls to nextLong produce at least two distinct results |
public SeekableOutputStream(RandomAccessFile file){
if (file == null) {
throw new IllegalArgumentException("SeekableOutputStream0");
}
this.file=file;
}
| Constructs a <code>SeekableOutputStream</code> from a <code>RandomAccessFile</code>. Unless otherwise indicated, all method invocations are fowarded to the underlying <code>RandomAccessFile</code>. |
public static boolean isValid(String s){
try {
new URI(UriEncoder.encode(s));
}
catch ( URISyntaxException e) {
return false;
}
return true;
}
| Tests whether a string is a valid URI reference. |
protected void beforeOffer(final T t){
}
| All attempts to add an element to the buffer invoke this hook before checking the remaining capacity in the buffer. The caller will be synchronized on <i>this</i> when this method is invoked. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-02-25 10:38:09.758 -0500",hash_original_method="CCA9C7445DF582DF0CAE5EF884DC96A3",hash_generated_method="8310CE4D93D9519205CC50F2FD928EA8") public Threadable thread(Threadable[] messages){
if (messages == null) return null;
idTable=new HashMap();
for (int i=0; i < messages.length; ++i) {
if (!messages[i].isDummy()) buildContainer(messages[i]);
}
root=findRootSet();
idTable.clear();
idTable=null;
pruneEmptyContainers(root);
root.reverseChildren();
gatherSubjects();
if (root.next != null) throw new RuntimeException("root node has a next:" + root);
for (ThreadContainer r=root.child; r != null; r=r.next) {
if (r.threadable == null) r.threadable=r.child.threadable.makeDummy();
}
Threadable result=(root.child == null ? null : root.child.threadable);
root.flush();
root=null;
return result;
}
| The main threader entry point - The client passes in an array of Threadable objects, and the Threader constructs a connected 'graph' of messages |
public ConfigReadException(String message){
super(message);
}
| Instantiates a new config read exception. |
protected void scaleTo(Projection thisProj){
if (DEBUG) {
logger.fine("starting scaling evaluation.");
}
if (bitmap == null) {
if (DEBUG) {
logger.fine("source image is null");
}
return;
}
Rectangle winRect=new Rectangle(thisProj.getWidth(),thisProj.getHeight());
Rectangle projRect=new Rectangle();
projRect.setLocation(point1);
projRect.setSize(point2.x - point1.x,point2.y - point1.y);
Rectangle sourceRect=new Rectangle();
sourceRect.width=bitmap.getWidth(this);
sourceRect.height=bitmap.getHeight(this);
clipRect=null;
Rectangle iRect=projRect;
if (corners == null || corners.size() <= 2) {
iRect=winRect.intersection(projRect);
}
if (!iRect.isEmpty()) {
Rectangle nClipRect=new Rectangle();
nClipRect.setBounds(sourceRect);
if ((iRect.width >= 1) && (iRect.height >= 1)) {
if (!winRect.contains(projRect)) {
double xScaleFactor=(double)sourceRect.width / (double)projRect.width;
double yScaleFactor=(double)sourceRect.height / (double)projRect.height;
int xOffset=iRect.x - projRect.x;
int yOffset=iRect.y - projRect.y;
nClipRect.x=(int)Math.floor(xOffset * xScaleFactor);
nClipRect.y=(int)Math.floor(yOffset * yScaleFactor);
nClipRect.width=(int)Math.ceil(iRect.width * xScaleFactor);
nClipRect.height=(int)Math.ceil(iRect.height * yScaleFactor);
if (nClipRect.width + nClipRect.x > sourceRect.width) {
nClipRect.width=sourceRect.width - nClipRect.x;
}
if (nClipRect.height + nClipRect.y > sourceRect.height) {
nClipRect.height=sourceRect.height - nClipRect.y;
}
}
if (nClipRect.width <= 0) {
nClipRect.width=1;
}
if (nClipRect.height <= 0) {
nClipRect.height=1;
}
double widthAdj=(double)iRect.width / (double)nClipRect.width;
double heightAdj=(double)iRect.height / (double)nClipRect.height;
AffineTransform xform=new AffineTransform();
xform.setToScale(widthAdj,heightAdj);
clipRect=nClipRect;
this.scalingXFormOp=new AffineTransformOp(xform,getScaleTransformType());
point1.setLocation(iRect.x,iRect.y);
point2.setLocation(iRect.x + iRect.width,iRect.y + iRect.height);
}
}
}
| Take the current projection and the sourceImage, and make the image that gets displayed fit the projection. If the source image isn't over the map, then this OMGraphic is set to be invisible. If part of the image is on the map, only that part is used. The OMRaster bitmap variable is set with an image that is created from the source image, and the point1 variable is set to the point where the image should be placed. For instance, if the source image upper left corner is off the map to the NorthWest, then the OMRaster bitmap is set to a image, clipped from the source, that is entirely on the map. The OMRaster point1 is set to 0, 0, since that is where the clipped image should be placed. |
public static ViewPropertyAnimator showViewByScale(View v){
ViewPropertyAnimator propertyAnimator=v.animate().setStartDelay(DEFAULT_DELAY).scaleX(1).scaleY(1);
return propertyAnimator;
}
| Shows a view by scaling |
@Override protected EClass eStaticClass(){
return SexecPackage.Literals.TRACE_REACTION_WILL_FIRE;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public static void assertPathDoesNotExist(FileSystem fileSystem,String message,Path path) throws IOException {
try {
FileStatus status=fileSystem.getFileStatus(path);
if (status != null) {
fail(message + ": unexpectedly found " + path+ " as "+ status);
}
}
catch ( FileNotFoundException expected) {
}
}
| Assert that a path does not exist |
public XmlHandler overrideAnnotatedClassAll(Class<?>... classes){
for ( Class<?> clazz : classes) overrideAnnotatedClass(clazz,true);
return this;
}
| This method rewrite a Xml Configuration of the Annotated Class given as input.<br> If the class has inner classes and they are mapped, their configuration will be rewritten. |
public Object opt(String key){
return key == null ? null : this.map.get(key);
}
| Get an optional value associated with a key. |
public static boolean isDetailedStatistics(){
return _isDetailedStatistics;
}
| Detailed statistics cause various parts of the server to keep more detailed statistics at the possible expense of some performance. |
@Override public BlockingQueue<SolrDocument> concurrentDocumentsByQuery(final String querystring,final String sort,final int offset,final int maxcount,final long maxtime,final int buffersize,final int concurrency,final boolean prefetchIDs,final String... fields){
List<String> querystrings=new ArrayList<>(1);
querystrings.add(querystring);
return concurrentDocumentsByQueries(querystrings,sort,offset,maxcount,maxtime,buffersize,concurrency,prefetchIDs,fields);
}
| Get results from a solr query as a stream of documents. The result queue is considered as terminated if AbstractSolrConnector.POISON_DOCUMENT is returned. The method returns immediately and feeds the search results into the queue |
private void snoopDHCPClientName(Ethernet eth,Device srcDevice){
if (!(eth.getPayload() instanceof IPv4)) return;
IPv4 ipv4=(IPv4)eth.getPayload();
if (!(ipv4.getPayload() instanceof UDP)) return;
UDP udp=(UDP)ipv4.getPayload();
if (!(udp.getPayload() instanceof DHCP)) return;
DHCP dhcp=(DHCP)udp.getPayload();
byte opcode=dhcp.getOpCode();
if (opcode == DHCP.OPCODE_REQUEST) {
DHCPOption dhcpOption=dhcp.getOption(DHCPOptionCode.OptionCode_Hostname);
if (dhcpOption != null) {
cntDhcpClientNameSnooped.increment();
srcDevice.dhcpClientName=new String(dhcpOption.getData());
}
}
}
| Snoop and record client-provided host name from DHCP requests |
@SuppressWarnings("CallToThreadStartDuringObjectConstruction") public GridClientImpl(UUID id,GridClientConfiguration cfg0,boolean routerClient) throws GridClientException {
this.id=id;
cfg=new GridClientConfiguration(cfg0);
boolean success=false;
try {
top=new GridClientTopology(cfg);
for ( GridClientDataConfiguration dataCfg : cfg.getDataConfigurations()) {
GridClientDataAffinity aff=dataCfg.getAffinity();
if (aff instanceof GridClientTopologyListener) addTopologyListener((GridClientTopologyListener)aff);
}
if (cfg.getBalancer() instanceof GridClientTopologyListener) top.addTopologyListener((GridClientTopologyListener)cfg.getBalancer());
GridSslContextFactory factory=cfg.getSslContextFactory();
if (factory != null) {
try {
sslCtx=factory.createSslContext();
}
catch ( SSLException e) {
throw new GridClientException("Failed to create client (unable to create SSL context, " + "check ssl context factory configuration): " + e.getMessage(),e);
}
}
if (cfg.isAutoFetchMetrics() && !cfg.isEnableMetricsCache()) log.warning("Auto-fetch for metrics is enabled without enabling caching for them.");
if (cfg.isAutoFetchAttributes() && !cfg.isEnableAttributesCache()) log.warning("Auto-fetch for node attributes is enabled without enabling caching for them.");
srvs=parseAddresses(cfg.getServers());
routers=parseAddresses(cfg.getRouters());
if (srvs.isEmpty() && routers.isEmpty()) throw new GridClientException("Servers addresses and routers addresses cannot both be empty " + "for client (please fix configuration and restart): " + this);
if (!srvs.isEmpty() && !routers.isEmpty()) throw new GridClientException("Servers addresses and routers addresses cannot both be provided " + "for client (please fix configuration and restart): " + this);
connMgr=createConnectionManager(id,sslCtx,cfg,routers,top,null,routerClient);
try {
tryInitTopology();
}
catch ( GridClientException e) {
top.fail(e);
log.warning("Failed to initialize topology on client start. Will retry in background.");
}
catch ( InterruptedException e) {
Thread.currentThread().interrupt();
throw new GridClientException("Client startup was interrupted.",e);
}
topUpdateThread=new TopologyUpdaterThread();
topUpdateThread.setDaemon(true);
topUpdateThread.start();
compute=new GridClientComputeImpl(this,null,null,cfg.getBalancer());
if (log.isLoggable(Level.INFO)) log.info("Client started [id=" + id + ", protocol="+ cfg.getProtocol()+ ']');
success=true;
}
finally {
if (!success) stop(false);
}
}
| Creates a new client based on a given configuration. |
public static void handle(Response response,String successMessageKey,Object... params){
ReturnCode returnCode=response.getMostSevereReturnCode();
if (returnCode != null) {
JSFUtils.addMessage(returnCode.getMember(),mapToFaces(returnCode.getType()),returnCode.getMessageKey(),returnCode.getMessageParam());
}
else {
JSFUtils.addMessage(null,FacesMessage.SEVERITY_INFO,successMessageKey,params);
}
}
| Adds the message contained in the response to the Faces context |
public PLDataRunnable(PLFileDownloaderListener listener,String url,byte[] data,long startTime){
super();
mListener=listener;
mURL=url;
mData=data;
mStartTime=startTime;
}
| init methods |
public DoubleVector copy(){
return (DoubleVector)clone();
}
| Makes a deep copy of the vector |
public Property property(DateTimeFieldType type){
if (type == null) {
throw new IllegalArgumentException("The DateTimeFieldType must not be null");
}
DateTimeField field=type.getField(getChronology());
if (field.isSupported() == false) {
throw new IllegalArgumentException("Field '" + type + "' is not supported");
}
return new Property(this,field);
}
| Gets the property object for the specified type, which contains many useful methods. |
public static final List<INaviRawModule> loadRawModules(final AbstractSQLProvider provider) throws CouldntLoadDataException {
Preconditions.checkNotNull(provider,"IE00416: Provider argument can not be null");
final CConnection connection=provider.getConnection();
final List<INaviRawModule> modules=new ArrayList<INaviRawModule>();
if (!PostgreSQLHelpers.hasTable(connection,CTableNames.RAW_MODULES_TABLE)) {
return modules;
}
final String query="SELECT id, name FROM " + CTableNames.RAW_MODULES_TABLE + " ORDER BY id";
try (ResultSet resultSet=connection.executeQuery(query,true)){
while (resultSet.next()) {
final int rawModuleId=resultSet.getInt("id");
final String name=PostgreSQLHelpers.readString(resultSet,"name");
final boolean isComplete=PostgreSQLDatabaseFunctions.checkRawModulesTables(provider.getConnection(),PostgreSQLHelpers.getDatabaseName(provider.getConnection()),rawModuleId);
final int functionCount=isComplete ? PostgreSQLDatabaseFunctions.getRawModuleFunctionCount(connection,rawModuleId) : 0;
final CRawModule module=new CRawModule(rawModuleId,name,functionCount,isComplete,provider);
modules.add(module);
}
}
catch ( final SQLException e) {
throw new CouldntLoadDataException(e);
}
return modules;
}
| Loads the raw modules of a database. |
public _BuildAgentUpdate(final _BuildAgentUpdate_Flag[] flags){
super(flags);
}
| Constructs a _BuildAgentUpdate with the given flags initially set. |
public boolean isActive(){
return this.active;
}
| Return whether this request is still active (that is, not completed yet). |
public LeafNode(){
}
| Construct an empty leaf node |
public void run() throws Exception {
String randomFactor=Integer.toString(1000 + (new SecureRandom()).nextInt(9000));
String username="SusanJones-" + randomFactor;
String givenName="Susan";
String familyName="Jones";
String password="123$$abc";
String testGroupName="discuss_general";
String testGroupId="newgroup-" + randomFactor;
String testGroupDescription="Discuss";
String memberUserName="john.doe." + randomFactor;
String memberFirstName="John";
String memberLastName="Doe";
String memberPassword="123$$$abc";
String ownerUserName="jane.doe." + randomFactor;
String ownerFirstName="Jane";
String ownerLastName="Doe";
String ownerPassword="123$$$abc";
UserEntry createdUserEntry=createUser(username,givenName,familyName,password);
String newFamilyName="Smith";
createdUserEntry.getName().setFamilyName(newFamilyName);
UserEntry updatedUserEntry=updateUser(username,createdUserEntry);
String nickname0="Susy-" + randomFactor;
NicknameEntry createdNicknameEntry0=createNickname(username,nickname0);
String nickname1="Suse-" + randomFactor;
NicknameEntry createdNicknameEntry1=createNickname(username,nickname1);
NicknameFeed retrievedNicknameFeed=retrieveNicknames(username);
StringBuffer nicknames=new StringBuffer();
Iterator<NicknameEntry> nicknameIterator=retrievedNicknameFeed.getEntries().iterator();
while (nicknameIterator.hasNext()) {
nicknames.append(nicknameIterator.next().getNickname().getName());
if (nicknameIterator.hasNext()) {
nicknames.append(", ");
}
}
LOGGER.log(Level.INFO,"User '" + username + "' has the following nicknames: {"+ nicknames.toString()+ "}.");
deleteNickname(nickname0);
deleteNickname(nickname1);
String emailList="Staff-" + randomFactor;
EmailListEntry createdEmailListEntry=createEmailList(emailList);
addRecipientToEmailList(username + "@" + domain,emailList);
addRecipientToEmailList("[email protected]",emailList);
EmailListFeed retrievedEmailListFeed=retrieveEmailLists(username);
StringBuffer emailLists=new StringBuffer();
Iterator<EmailListEntry> emailListIterator=retrievedEmailListFeed.getEntries().iterator();
while (emailListIterator.hasNext()) {
emailLists.append(emailListIterator.next().getEmailList().getName());
if (emailListIterator.hasNext()) {
emailLists.append(", ");
}
}
LOGGER.log(Level.INFO,"User '" + username + "' is in the following emailLists: {"+ emailLists.toString()+ "}.");
LOGGER.log(Level.INFO,"Creating users for groups sample run");
createUser(memberUserName,memberFirstName,memberLastName,memberPassword);
createUser(ownerUserName,ownerFirstName,ownerLastName,ownerPassword);
GenericFeed groupsFeed=null;
GenericEntry groupsEntry=null;
Iterator<GenericEntry> groupsEntryIterator=null;
LOGGER.log(Level.INFO,"Creating group: " + testGroupId);
groupsEntry=groupService.createGroup(testGroupId,testGroupName,testGroupDescription,"");
LOGGER.log(Level.INFO,"Group created with following properties:\n" + groupsEntry.getAllProperties());
groupsEntry=groupService.addMemberToGroup(testGroupId,memberUserName);
LOGGER.log(Level.INFO,"Added member: \n" + groupsEntry.getAllProperties());
groupsEntry=groupService.addOwnerToGroup(testGroupId,ownerUserName);
LOGGER.log(Level.INFO,"Added owner: \n" + groupsEntry.getAllProperties());
groupsEntry=groupService.updateGroup(testGroupId,testGroupName,testGroupDescription + "Updated: ","");
LOGGER.log(Level.INFO,"Updated group description:\n" + groupsEntry.getAllProperties());
groupsFeed=groupService.retrieveAllMembers(testGroupId);
groupsEntryIterator=groupsFeed.getEntries().iterator();
StringBuffer members=new StringBuffer();
while (groupsEntryIterator.hasNext()) {
members.append(groupsEntryIterator.next().getProperty(AppsGroupsService.APPS_PROP_GROUP_MEMBER_ID));
if (groupsEntryIterator.hasNext()) {
members.append(", ");
}
}
LOGGER.log(Level.INFO,testGroupId + " has these members: " + members.toString());
groupsFeed=groupService.retreiveGroupOwners(testGroupId);
groupsEntryIterator=groupsFeed.getEntries().iterator();
StringBuffer owners=new StringBuffer();
while (groupsEntryIterator.hasNext()) {
owners.append(groupsEntryIterator.next().getProperty(AppsGroupsService.APPS_PROP_GROUP_EMAIL));
if (groupsEntryIterator.hasNext()) {
owners.append(", ");
}
}
LOGGER.log(Level.INFO,testGroupName + " has these owners: " + owners.toString());
groupsFeed=groupService.retrieveAllGroups();
groupsEntryIterator=groupsFeed.getEntries().iterator();
StringBuffer groups=new StringBuffer();
while (groupsEntryIterator.hasNext()) {
groups.append(groupsEntryIterator.next().getProperty(AppsGroupsService.APPS_PROP_GROUP_ID));
if (groupsEntryIterator.hasNext()) {
groups.append(", ");
}
}
LOGGER.log(Level.INFO,"Domain has these groups:\n" + groups.toString());
groupsFeed=groupService.retrieveGroups(memberUserName,true);
groupsEntryIterator=groupsFeed.getEntries().iterator();
groups=new StringBuffer();
while (groupsEntryIterator.hasNext()) {
groups.append(groupsEntryIterator.next().getProperty(AppsGroupsService.APPS_PROP_GROUP_ID));
if (groupsEntryIterator.hasNext()) {
groups.append(", ");
}
}
LOGGER.log(Level.INFO,memberUserName + " is subscribed to these groups:\n" + groups.toString());
boolean isMember=groupService.isMember(testGroupId,memberUserName);
LOGGER.log(Level.INFO,memberUserName + " is member of " + testGroupId+ "?: "+ isMember);
boolean isOwner=groupService.isOwner(testGroupId,ownerUserName);
LOGGER.log(Level.INFO,ownerUserName + " is owner of " + testGroupId+ "?: "+ isOwner);
groupService.removeOwnerFromGroup(ownerUserName + "@" + domain,testGroupId);
LOGGER.log(Level.INFO,"Removing " + ownerUserName + " as owner from group "+ testGroupId);
groupService.deleteGroup(testGroupId);
deleteUser(memberUserName);
deleteUser(ownerUserName);
deleteEmailList(emailList);
deleteUser(username);
String fakeUsername="SusanJones-fake";
try {
deleteUser(fakeUsername);
}
catch ( AppsForYourDomainException e) {
if (e.getErrorCode() == AppsForYourDomainErrorCode.EntityDoesNotExist) {
LOGGER.log(Level.INFO,"Do some post-error processing or logging.");
}
}
}
| Driver for the sample. |
public boolean isMacOSX(){
return operatingSystem == OperatingSystem.MACOSX;
}
| Tests whether the user is using Mac OS X. |
public int inferStreamType(){
switch (mType) {
case TYPE_ALARM:
return AudioManager.STREAM_ALARM;
case TYPE_NOTIFICATION:
return AudioManager.STREAM_NOTIFICATION;
default :
return AudioManager.STREAM_RING;
}
}
| Infers the playback stream type based on what type of ringtones this manager is returning. |
public void addRisikoMassnahmenUmsetzungen(List<RisikoMassnahme> allRisikoMassnahmen){
for ( RisikoMassnahme massnahme : allRisikoMassnahmen) {
addRisikoMassnahmeUmsetzung(massnahme);
}
}
| Adds the own Massnahmen to the List of all Massnahmen from BSI IT-Grundschutz-Kataloge. |
public String resourceLocation(String resource){
Path inConfigDir=getInstancePath().resolve("conf").resolve(resource);
if (Files.exists(inConfigDir) && Files.isReadable(inConfigDir)) return inConfigDir.toAbsolutePath().normalize().toString();
Path inInstanceDir=getInstancePath().resolve(resource);
if (Files.exists(inInstanceDir) && Files.isReadable(inInstanceDir)) return inInstanceDir.toAbsolutePath().normalize().toString();
try (InputStream is=classLoader.getResourceAsStream(resource.replace(File.separatorChar,'/'))){
if (is != null) return "classpath:" + resource;
}
catch ( IOException e) {
}
return resource;
}
| Report the location of a resource found by the resource loader |
public void paint(Graphics g){
int width=getWidth();
int height=getHeight();
if (editingIcon != null) {
int yLoc=calculateIconY(editingIcon);
if (getComponentOrientation().isLeftToRight()) {
editingIcon.paintIcon(this,g,0,yLoc);
}
else {
editingIcon.paintIcon(this,g,width - editingIcon.getIconWidth(),yLoc);
}
}
Color background=getBorderSelectionColor();
if (background != null) {
g.setColor(background);
g.drawRect(0,0,width - 1,height - 1);
}
super.paint(g);
}
| Overrides <code>Container.paint</code> to paint the node's icon and use the selection color for the background. |
public int addHistogramPlot(String name,double[][] XYdX){
return addHistogramPlot(name,getNewColor(),XYdX);
}
| Adds a histogram plot to the current plot panel. Each data point is as vertical bar which width can be set. |
public void arcade(double driveSpeed,double turnSpeed,boolean squaredInputs){
double leftMotorSpeed;
double rightMotorSpeed;
driveSpeed=speedLimiter.applyAsDouble(driveSpeed);
turnSpeed=speedLimiter.applyAsDouble(turnSpeed);
if (squaredInputs) {
if (driveSpeed >= 0.0) {
driveSpeed=(driveSpeed * driveSpeed);
}
else {
driveSpeed=-(driveSpeed * driveSpeed);
}
if (turnSpeed >= 0.0) {
turnSpeed=(turnSpeed * turnSpeed);
}
else {
turnSpeed=-(turnSpeed * turnSpeed);
}
}
if (driveSpeed > 0.0) {
if (turnSpeed > 0.0) {
leftMotorSpeed=driveSpeed - turnSpeed;
rightMotorSpeed=Math.max(driveSpeed,turnSpeed);
}
else {
leftMotorSpeed=Math.max(driveSpeed,-turnSpeed);
rightMotorSpeed=driveSpeed + turnSpeed;
}
}
else {
if (turnSpeed > 0.0) {
leftMotorSpeed=-Math.max(-driveSpeed,turnSpeed);
rightMotorSpeed=driveSpeed + turnSpeed;
}
else {
leftMotorSpeed=driveSpeed - turnSpeed;
rightMotorSpeed=-Math.max(-driveSpeed,-turnSpeed);
}
}
left.setSpeed(leftMotorSpeed);
right.setSpeed(rightMotorSpeed);
}
| Arcade drive implements single stick driving. This function lets you directly provide joystick values from any source. |
public void writeXml(java.io.OutputStream oStream) throws SQLException, IOException {
if (xmlWriter != null) {
curPosBfrWrite=this.getRow();
xmlWriter.writeXML(this,oStream);
}
else {
throw new SQLException(resBundle.handleGetObject("webrowsetimpl.invalidwr").toString());
}
}
| Writes this <code>WebRowSet</code> object to the given <code> OutputStream</code> object in XML format. Creates an an output stream of the internal state and contents of a <code>WebRowSet</code> for XML proceessing |
public String randomSeedTipText(){
return "Random number seed.";
}
| Returns the tip text for this property |
@Ignore @Test public void onTouchUpAction_eventWhenLeftOverscrolling_smoothScrollBackToRightEnd() throws Exception {
MotionEvent moveEvent=createShortLeftMoveEvent();
when(mViewAdapter.isInAbsoluteStart()).thenReturn(false);
when(mViewAdapter.isInAbsoluteEnd()).thenReturn(true);
HorizontalOverScrollBounceEffectDecorator uut=getUUT();
uut.onTouch(mView,moveEvent);
reset(mView);
float viewX=moveEvent.getX();
when(mView.getTranslationX()).thenReturn(viewX);
MotionEvent upEvent=createDefaultUpActionEvent();
boolean ret=uut.onTouch(mView,upEvent);
assertTrue(ret);
verify(mView,atLeastOnce()).setTranslationX(anyFloat());
}
| TODO: Make this work using a decent animation shadows / newer Robolectric |
protected void sequence_Wildcard(ISerializationContext context,Wildcard semanticObject){
genericSequencer.createSequence(context,semanticObject);
}
| Contexts: TypeArgInTypeTypeRef returns Wildcard Wildcard returns Wildcard Constraint: (declaredUpperBound=TypeRef | declaredLowerBound=TypeRef)? |
public LocalDate roundHalfCeilingCopy(){
return iInstant.withLocalMillis(iField.roundHalfCeiling(iInstant.getLocalMillis()));
}
| Rounds to the nearest whole unit of this field on a copy of this LocalDate, favoring the ceiling if halfway. |
public static <T extends CompilationResult>T compileGraph(StructuredGraph graph,ResolvedJavaMethod installedCodeOwner,Providers providers,Backend backend,PhaseSuite<HighTierContext> graphBuilderSuite,OptimisticOptimizations optimisticOpts,ProfilingInfo profilingInfo,Suites suites,LIRSuites lirSuites,T compilationResult,CompilationResultBuilderFactory factory){
return compile(new Request<>(graph,installedCodeOwner,providers,backend,graphBuilderSuite,optimisticOpts,profilingInfo,suites,lirSuites,compilationResult,factory));
}
| Requests compilation of a given graph. |
@Override public String toString(){
return this.state.toString();
}
| Returns a string representation of the environment |
public static void start(Activity activity){
new FirstRunSignInProcessor(activity,false,null);
}
| Initiates the automatic sign-in process in background. |
@CanIgnoreReturnValue @Deprecated @Override public ImmutableSet<V> replaceValues(K key,Iterable<? extends V> values){
throw new UnsupportedOperationException();
}
| Guaranteed to throw an exception and leave the multimap unmodified. |
public void buildDBColumn(final DBTable table,final AbstractSession session,final JPAMTableDefinition tableDef) throws ValidationException {
DBColumn column=null;
if (discriminatorColumn != null) {
column=new DBDiscriminatorColumn(name,discriminatorColumn);
}
else if (inherited) {
if (managedAttribute instanceof RelationAttribute) {
if (inverse) {
column=new DBParentAssociationInverseJoinColumn(name,intrinsicClass,(RelationAttribute)managedAttribute,relationTable);
}
else {
column=new DBParentAssociationJoinColumn(name,intrinsicClass,(RelationAttribute)managedAttribute,relationTable);
}
}
else {
column=new DBParentAttributeColumn(name,intrinsicClass,managedAttribute);
}
}
else if (foriegnKey && inverse && (intrinsicAttribute == null || intrinsicAttribute.isEmpty())) {
column=new DBPrimaryKeyJoinColumn(name,intrinsicClass,(Id)managedAttribute);
}
else if (intrinsicAttribute.size() == 1) {
if (intrinsicAttribute.peek() instanceof RelationAttribute) {
if (mapKey) {
column=buildMapKeyColumn();
}
else {
if (inverse) {
column=new DBInverseJoinColumn(name,(RelationAttribute)managedAttribute,relationTable);
}
else {
column=new DBJoinColumn(name,managedAttribute,relationTable);
}
}
}
else if (intrinsicAttribute.peek() instanceof ElementCollection) {
if (foriegnKey) {
column=new DBJoinColumn(name,managedAttribute,relationTable);
}
else if (mapKey) {
column=buildMapKeyColumn();
}
else {
column=new DBColumn(name,managedAttribute);
}
}
else if (foriegnKey && inverse && intrinsicAttribute.peek() instanceof Id) {
column=new DBPrimaryKeyJoinColumn(name,intrinsicClass,(Id)managedAttribute);
}
else {
column=new DBColumn(name,managedAttribute);
}
}
else if (intrinsicAttribute.size() > 1) {
if (intrinsicAttribute.get(0) instanceof RelationAttribute) {
if (mapKey) {
column=buildMapKeyColumn();
}
else {
if (inverse) {
column=new DBInverseJoinColumn(name,(RelationAttribute)managedAttribute,relationTable);
}
else {
column=new DBJoinColumn(name,managedAttribute,relationTable);
}
}
}
else if (intrinsicAttribute.get(0) instanceof Embedded) {
List<Embedded> embeddedList=new ArrayList<>();
for (int i=0; i < intrinsicAttribute.size() - 1; i++) {
embeddedList.add((Embedded)intrinsicAttribute.get(i));
}
if (managedAttribute instanceof RelationAttribute) {
if (inverse) {
column=new DBEmbeddedAssociationInverseJoinColumn(name,embeddedList,(RelationAttribute)managedAttribute,relationTable);
}
else {
column=new DBEmbeddedAssociationJoinColumn(name,embeddedList,(RelationAttribute)managedAttribute,relationTable);
}
}
else if (foriegnKey) {
column=new DBEmbeddedAttributeJoinColumn(name,embeddedList,managedAttribute);
}
else {
column=new DBEmbeddedAttributeColumn(name,embeddedList,managedAttribute);
}
}
else if (intrinsicAttribute.get(0) instanceof EmbeddedId) {
EmbeddedId embeddedId=(EmbeddedId)intrinsicAttribute.get(0);
if (intrinsicAttribute.size() > 2 && ((DefaultAttribute)intrinsicAttribute.get(1)).isDerived() && ((DefaultAttribute)intrinsicAttribute.get(1)).getConnectedAttribute() instanceof RelationAttribute) {
column=new DBInverseJoinColumn(name,(RelationAttribute)((DefaultAttribute)intrinsicAttribute.get(1)).getConnectedAttribute(),relationTable);
}
else {
if (((DefaultAttribute)managedAttribute).getConnectedAttribute() instanceof RelationAttribute) {
column=new DBInverseJoinColumn(name,(RelationAttribute)((DefaultAttribute)managedAttribute).getConnectedAttribute(),relationTable);
}
else if (((EmbeddedId)intrinsicAttribute.get(0)).getConnectedAttribute() instanceof RelationAttribute) {
column=new DBInverseJoinColumn(name,(RelationAttribute)((EmbeddedId)intrinsicAttribute.get(0)).getConnectedAttribute(),relationTable);
}
else {
column=new DBColumn(name,managedAttribute);
}
}
}
else if (intrinsicAttribute.get(0) instanceof ElementCollection) {
if (mapKey) {
column=buildMapKeyColumn();
}
else {
ElementCollection elementCollection=(ElementCollection)intrinsicAttribute.peek();
List<Embedded> embeddedList=new ArrayList<>();
embeddedList.add(new Embedded(elementCollection.getAttributeOverride()));
for (int i=1; i < intrinsicAttribute.size() - 1; i++) {
embeddedList.add((Embedded)intrinsicAttribute.get(i));
}
if (managedAttribute instanceof RelationAttribute) {
if (inverse) {
column=new DBEmbeddedAssociationInverseJoinColumn(name,embeddedList,(RelationAttribute)managedAttribute,relationTable);
}
else {
column=new DBEmbeddedAssociationJoinColumn(name,embeddedList,(RelationAttribute)managedAttribute,relationTable);
}
}
else if (foriegnKey) {
column=new DBEmbeddedAttributeJoinColumn(name,embeddedList,managedAttribute);
}
else {
column=new DBEmbeddedAttributeColumn(name,embeddedList,managedAttribute);
}
}
}
}
if (column == null) {
column=new DBColumn(name,managedAttribute);
}
column.setId(NBModelerUtil.getAutoGeneratedStringId());
if (getTypeDefinition() != null) {
}
else {
final FieldTypeDefinition fieldType=type != null ? session.getPlatform().getFieldTypeDefinition(type) : new FieldTypeDefinition(typeName);
if (fieldType == null) {
throw ValidationException.javaTypeIsNotAValidDatabaseType(type);
}
column.setDataType(fieldType.getName());
if ((fieldType.isSizeAllowed()) && ((this.getSize() != 0) || (fieldType.isSizeRequired()))) {
if (this.getSize() == 0) {
column.setSize(fieldType.getDefaultSize());
}
else {
column.setSize(this.getSize());
}
if (this.getSubSize() != 0) {
column.setSubSize(this.getSubSize());
}
else if (fieldType.getDefaultSubSize() != 0) {
column.setSubSize(fieldType.getDefaultSubSize());
}
}
if (shouldAllowNull && fieldType.shouldAllowNull()) {
column.setAllowNull(true);
}
else {
column.setAllowNull(false);
}
}
column.setUniqueKey(isUnique());
column.setPrimaryKey(isPrimaryKey() && session.getPlatform().supportsPrimaryKeyConstraint());
table.addColumn(column);
}
| INTERNAL: Append the database field definition string to the table creation statement. |
@Override public int describeContents(){
return 0;
}
| Implement the Parcelable interface |
public static boolean isBase64(final byte[] arrayOctet){
for (int i=0; i < arrayOctet.length; i++) {
if (!isBase64(arrayOctet[i]) && !isWhiteSpace(arrayOctet[i])) {
return false;
}
}
return true;
}
| Tests a given byte array to see if it contains only valid characters within the Base64 alphabet. Currently the method treats whitespace as valid. |
private boolean isDigitCharacter(int c){
return (c >= '0' && c <= '9') || c == 'e' || c == 'E' || c == '.' || c == '+' || c == '-';
}
| Quick test for digit characters. |
public void emitNewarray(int elemcode,Type arrayType){
emitop(newarray);
if (!alive) return;
emit1(elemcode);
state.pop(1);
state.push(arrayType);
}
| Emit newarray. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-02-25 10:38:10.325 -0500",hash_original_method="D59B525355274204B82DF4FF44540199",hash_generated_method="6173B1DB2E76F67DB3683D3E5D8DC8FE") public void addNewsgroup(String newsgroup){
if (__newsgroups != null) __newsgroups.append(',');
else __newsgroups=new StringBuffer();
__newsgroups.append(newsgroup);
}
| Add a newsgroup to the list of newsgroups being queried. Newsgroups added this way are only meaningful to the NEWNEWS command. Newsgroup names may include the <code> * </code> wildcard, as in <code>comp.lang.* </code> or <code> comp.lang.java.* </code>. Adding at least one newsgroup is mandatory for the NEWNEWS command. <p> |
public String mapMethodName(String owner,String name,String desc){
return name;
}
| Map method name to the new name. Subclasses can override. |
public EqualsBuilder append(boolean lhs,boolean rhs){
if (isEquals == false) {
return this;
}
isEquals=(lhs == rhs);
return this;
}
| <p>Test if two <code>booleans</code>s are equal.</p> |
@Override public void close(){
currentRow=null;
rows=null;
columns=null;
rowId=-1;
if (source != null) {
source.close();
source=null;
}
}
| Closes the result set and releases the resources. |
File directoryFor(Parameter parameter){
File result=_directoryFor(parameter);
uncheck();
return result;
}
| Searches down through databases to find the directory for the database which holds a given parameter. Returns the directory name or null if not found. |
private static int fixedFromGregorian(DateValue date){
return fixedFromGregorian(date.year(),date.month(),date.day());
}
| <p> Calculates the number of days since the epoch. </p> <p> This is the imaginary beginning of year zero in a hypothetical backward extension of the Gregorian calendar through time. See "Calendrical Calculations" by Reingold and Dershowitz. </p> |
public static void appendChildElement(Element parent,Element el,String[] order) throws IllegalArgumentException {
List<String> l=Arrays.asList(order);
int index=l.indexOf(el.getLocalName());
if (index == -1) {
throw new IllegalArgumentException("new child element '" + el.getLocalName() + "' not specified in order "+ l);
}
List<Element> elements=findSubElements(parent);
Element insertBefore=null;
for ( Element e : elements) {
int index2=l.indexOf(e.getLocalName());
if (index2 == -1) {
throw new IllegalArgumentException("Existing child element '" + e.getLocalName() + "' not specified in order "+ l);
}
if (index2 > index) {
insertBefore=e;
break;
}
}
parent.insertBefore(el,insertBefore);
}
| Append a child element to the parent at the specified location. Starting with a valid document, append an element according to the schema sequence represented by the <code>order</code>. All existing child elements must be include as well as the new element. The existing child element following the new child is important, as the element will be 'inserted before', not 'inserted after'. |
public boolean lock(Object key){
Object theLock;
synchronized (this) {
theLock=locks.get(key);
if (null == theLock) {
locks.put(key,getCallerId());
return true;
}
else return getCallerId() == theLock;
}
}
| Lock on a given object. |
private NSArray parseArray() throws ParseException {
skip();
skipWhitespacesAndComments();
List<NSObject> objects=new LinkedList<NSObject>();
while (!accept(ARRAY_END_TOKEN)) {
objects.add(parseObject());
skipWhitespacesAndComments();
if (accept(ARRAY_ITEM_DELIMITER_TOKEN)) {
skip();
}
else {
break;
}
skipWhitespacesAndComments();
}
read(ARRAY_END_TOKEN);
return new NSArray(objects.toArray(new NSObject[objects.size()]));
}
| Parses an array from the current parsing position. The prerequisite for calling this method is, that an array begin token has been read. |
public boolean isAuthenticated(){
return saslNegotiated;
}
| Returns true if the user was able to authenticate with the server usins SASL. |
public DoubleRangeField(String name,final double[] min,final double[] max){
super(name,getType(min.length));
setRangeValues(min,max);
}
| Create a new DoubleRangeField type, from min/max parallel arrays |
public static MethExecutorResult executeInstance(String receiver,String selector){
try {
Class receiverClass=Class.forName(receiver);
Object target=receiverClass.newInstance();
Object res=null;
try {
Method theMethod=getMethod(receiverClass,selector,new Class[0]);
res=theMethod.invoke(target,new Object[0]);
return new MethExecutorResult(res);
}
catch ( InvocationTargetException invTargEx) {
Throwable targEx=invTargEx.getTargetException();
if (targEx == null) {
return new MethExecutorResult(res);
}
else {
return new MethExecutorResult(targEx);
}
}
}
catch ( VirtualMachineError e) {
SystemFailure.initiateFailure(e);
throw e;
}
catch ( Throwable t) {
return new MethExecutorResult(t);
}
}
| Send the message "selector" to an instance of the class named "receiver". Return the result, including stack trace (if any). |
public static BufferedImage createRGBImageFromInvertedYCCK(Raster ycckRaster,ICC_Profile cmykProfile){
BufferedImage image;
if (cmykProfile != null) {
ycckRaster=convertInvertedYCCKToCMYK(ycckRaster);
image=createRGBImageFromCMYK(ycckRaster,cmykProfile);
}
else {
int w=ycckRaster.getWidth(), h=ycckRaster.getHeight();
int[] rgb=new int[w * h];
int[] Y=ycckRaster.getSamples(0,0,w,h,0,(int[])null);
int[] Cb=ycckRaster.getSamples(0,0,w,h,1,(int[])null);
int[] Cr=ycckRaster.getSamples(0,0,w,h,2,(int[])null);
int[] K=ycckRaster.getSamples(0,0,w,h,3,(int[])null);
float vr, vg, vb;
for (int i=0, imax=Y.length; i < imax; i++) {
float k=255 - K[i], y=255 - Y[i], cb=255 - Cb[i], cr=255 - Cr[i];
vr=y + 1.402f * (cr - 128) - k;
vg=y - 0.34414f * (cb - 128) - 0.71414f * (cr - 128) - k;
vb=y + 1.772f * (cb - 128) - k;
rgb[i]=(0xff & (vr < 0.0f ? 0 : vr > 255.0f ? 0xff : (int)(vr + 0.5f))) << 16 | (0xff & (vg < 0.0f ? 0 : vg > 255.0f ? 0xff : (int)(vg + 0.5f))) << 8 | (0xff & (vb < 0.0f ? 0 : vb > 255.0f ? 0xff : (int)(vb + 0.5f)));
}
Raster rgbRaster=Raster.createPackedRaster(new DataBufferInt(rgb,rgb.length),w,h,w,new int[]{0xff0000,0xff00,0xff},null);
ColorSpace cs=ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel cm=new DirectColorModel(cs,24,0xff0000,0xff00,0xff,0x0,false,DataBuffer.TYPE_INT);
image=new BufferedImage(cm,(WritableRaster)rgbRaster,true,null);
}
return image;
}
| Creates a buffered image from a raster in the inverted YCCK color space, converting the colors to RGB using the provided CMYK ICC_Profile. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.